An error occurred in script '/home/yhr1ef23xez5/public_html/web2/app/model/bannerhit.php' on line 17:

Undefined index: HTTP_REFERER

Array ( [type] => solution [name] => compile-option )

WinWrap® Basic is an embedded language control available for .NET/COM 32/64 bit Windows applications. The WinWrap® Basic Component is compatible with VBA, Sax Basic, VB.NET and Visual Basic 6.0 style scripts.

Speed up WWB.NET code by 100 times, or more, with the WinWrap® Basic Version 10 compiler option.

- Compile speed-critical WinWrap® Basic library projects
- Utilize the full power of VB.NET code
- Access application defined language extensions
- Call compiled code directly from WWB.NET scripts
- Call compiled code via delegates
- Use any of thousands of .NET Framework Classes

WinWrap® Basic implements the WWB.NET/Compiled language using Microsoft's VB.NET compiler component. A WWB.NET/Compiled project is compiled on demand the first time it is used. Changes to the project cause the code to be recompiled on demand the next time it is used. The compiled code is completely managed by the WinWrap® Basic environment. Additionally, the language extensions added by the application are available from a WWB.NET/Compiled project.

Where script execution speed is critical, you now have the option of compiling the script as a WWB.NET/Compiled library. Click on one of the links below to evaluate the WinWrap® Basic Compile Option.

WinWrap® Basic's compile option is a good choice for compute intensive code, speed critical code routines.

- Maximum execution speed is critical
- Compiled computations are guaranteed to be fast
- Or, the computations can be broken into chunks

WinWrap® Basic's WWB.NET scripting development and execution environment has been optimized for script writers and users.

- Allows users to pause and halt executing scripts
- Cooperatively multitasks with the foreground task
- Optimized debugging features
- Call compiled code libraries

The following WWB.NET and WWB.NET/Compiled code demonstrates how to use the WinWrap® Basic Version 10 compiled option.

- WWB.NET compile option demo output:

Calculate Primes in Compiled Library Code 224737 is the 20000th prime Compiled library code calculated 20000 primes in 252 ms Calculate Primes in Scripted Code 224737 is the 20000th prime Scripted code calculated 20000 primes in 45818 ms 182x Speed Improvement for Compiled Library Code

You can download this WinWrap® Basic compile option demo code by clicking the following link: WinWrap® Basic Version 10 WWB.NET Compile Option Demo.

Using the WinWrap® Director program shipped with WinWrap® Basic .NET Version follow the instructions below to create a demo program for calculating the first n primes.

- Download the WinWrap® Basic compile code demo
- Open WinWrap® Director (shipped with WinWrap® Basic evaluation)
- Open the PrimesProject.wwp project with WinWrap® Director
- Select the PrimesProject-MainModule.wwm
- Run the demo by pressing the Project | Run menu choice
- Monitor primes calculations as they progress
- Observe the compile speed increase for this primes calculation

The primes will be calculated first with compiled code (fast) and then with script code (not as fast). The highest prime calculated will be printed out as the primes calculations progresses.

- In the Executable Project PrimesProject.wwp the "EntryPoint Main" command selects the "Sub Main()" subroutine to begin executing. The "ReferenceProject" command brings the CompiledProject symbols into this executable project.

'#Language "WWB.NET"
Project PrimesProject
EntryPoint Main
LoadModule "PrimesProject-MainModule.wwm"
LoadModule "PrimesProject-Engine.wwm"
ReferenceProject "PrimesLibrary.wwp"
End Project

- You can use F8 (Step Into) to see PrimesProject.wwp "Sub Main" execute line-by-line.

Imports System.Collections
Module MainModule
Public Sub Main
Debug.Clear
Dim limit As Integer = 10000
Dim prime As Long
Dim tstart As Date
Debug.Print "Calculate Primes in Compiled Library Code"
tstart = Now
prime = PrimesLibrary.Engine.NthPrime(limit)
Dim compiledMS As Long = (Now-tstart).TotalMilliseconds
Debug.Print " " & prime & " is the " & limit & "th prime"
Debug.Print " Compiled library code calculated " & limit & " primes in " _
& compiledMS & " ms"
Debug.Print "Calculate Primes in Scripted Code"
tstart = Now
prime = Engine.NthPrime(limit)
Dim scriptedMS As Long = (Now-tstart).TotalMilliseconds
Debug.Print " " & prime & " is the " & limit & "th prime"
Debug.Print " Scripted code calculated " & limit & " primes in " _
& scriptedMS & " ms"
Dim ratio As Integer = scriptedMS/compiledMS
Debug.Print ratio & "x Speed Improvement for Compiled Library Code"
Stop
End Sub
End Module

- The NthPrime function calulates the nth prime, returning it to the calling routine.

Imports System.Collections
Public Module Engine
Private primes As ArrayList
Public Function NthPrime(ByVal limit As Integer) As Long
primes = New ArrayList
primes.Add(2)
Dim n As Long = 1
Do Until primes.Count >= limit
n += 2
If IsPrime(n) Then primes.Add(n)
Loop
Return primes.Item(limit-1)
End Function
Private Function IsPrime(ByVal n As Long) As Boolean
Dim limit As Long = CLng(n ^ .5)
For Each prime As Long In primes
If prime > limit Then Exit For
If n Mod prime = 0 Then Return False
Next
Return True
End Function
End Module

- WinWrap® Basic designates compiled code with the '#Language "WWB.NET/Compiled" directive.

'#Language "WWB.NET/Compiled"
Project PrimesLibrary
LoadModule "PrimesLibrary-Engine.wwm"
End Project

- The NthPrime function calulates the nth prime, returning it to the calling routine.

Imports System.Collections
Public Module Engine
Private primes As ArrayList
Public Function NthPrime(ByVal limit As Integer) As Long
primes = New ArrayList
primes.Add(2)
Dim n As Long = 1
Do Until primes.Count >= limit
n += 2
If IsPrime(n) Then primes.Add(n)
Loop
Return primes.Item(limit-1)
End Function
Private Function IsPrime(ByVal n As Long) As Boolean
Dim limit As Long = CLng(n ^ .5)
For Each prime As Long In primes
If prime > limit Then Exit For
If n Mod prime = 0 Then Return False
Next
Return True
End Function
End Module

- You can download this WinWrap® Basic compile option demo code by clicking the following link: WinWrap® Basic Version 10 WWB.NET Compile Option Demo. Then open the PrimesProject.wwp project with WinWrap® Director. WinWrap® Director is part of the WinWrap® Basic Scripting Engine evaluation.

Speed up WWB.NET code by 100 times, or more, with the WinWrap® Basic Version 10 compiler option. Where execution speed is critical WinWrap® Basic Version 10's new compile capability will provide the solution.

Visual Basic on Wikipedia, "The Visual Basic compiler is shared with other Visual Studio languages (C, C++)."

Cross Compiler on Wikipedia, "Microsoft developed the Common Language Runtime (CLR) which forms the core for their DotNET (.NET) compiler in the Visual Studio IDE."

Visual Basic Development Center by Microsoft, "The .NET Framework has two main components: the common language runtime and the .NET Framework class library."

Visual Basic Home by Microsoft.

Copyright Polar Engineering, Inc.