PlayBASIC V1.64P (Work In Progress) Gallery

Started by kevin, August 31, 2013, 02:38:09 PM

Previous topic - Next topic

kevin

#60
 PlayBASIC V1.64P3 BETA #15 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (12th Oct,2015)


     V1.64P3 Beta #15 this one includes updated Documentation and more translated commands with things like the FastCall parser being moved into the new instruction set format inside the runtime.   This gives you more computational bang if you need long floating point calculations.   The trade off point seems to be calculations that include 3 or more operations.  

     Here's some example FastCalc code, it's not like a normal expression, in these you have to order the instructions manually.   This way there's no compiler getting in the way of the order of operations, you control it..
   
PlayBASIC Code: [Select]
; Init some variables to perform some calculations with
a#=10
b#=20
c#=30
d#=40



; ===============
; Example #1
; ===============
print "-----------------------------------------------------------"

; A normal expression
Result#= A# +b#+C#

; The same expression rearranged for FastCalc
FastCalc FastCalcResult#=A# +b#+C#

Print Result#
Print FastCalcResult#

; sync
;waitkey



; ===============
; Example #2
; ===============
print "-----------------------------------------------------------"

; A normal expression

Result#= A# +b#*10

; The same expression rearranged for FastCalc
Temp#=10
FastCalc FastCalcResult#=b#*temp#+a#

Print Result#
Print FastCalcResult#



; ===============
; Example #3
; ===============
print "-----------------------------------------------------------"

; A normal expression
Result#= Cos(a#) * c#

; The same expression rearranged for FastCalc
FastCalc FastCalcResult#=C# * Cos(a#)

; Note Operations like COS/SIN etc can't be the
; first operation in the FastCalc list

Print Result#
Print FastCalcResult#


; ===============
; Example #4
; ===============
print "-----------------------------------------------------------"

; A normal expression
Result#= (B#*C#) +(b#+D#)
; The same expression rearranged for FastCalc
FastCalc FastCalcResult#= b# *C#=temp#, B#+D#+Temp#

Print Result#
Print FastCalcResult#


print "-----------------------------------------------------------"

Radius#=100
Angle#=327
BaseX#=1000

; A normal expression
Result#= Cos(Angle#) * Radius# + BaseX#

; The same expression rearranged for FastCalc
FastCalc FastCalcResult#=Radius# * Cos(Angle#) + BaseX#

Print Result#
Print FastCalcResult#




print "-----------------------------------------------------------"
; A normal expression
Result#= Tan(Angle#) * Radius#

; The same expression rearranged for FastCalc
FastCalc FastCalcResult#=Radius# * Tan(Angle#)

Print Result#
Print FastCalcResult#


print "-----------------------------------------------------------"
; A normal expression
Result#= Rnd(Angle#) * Radius#

; The same expression rearranged for FastCalc
FastCalc FastCalcResult#=Radius# * Rnd(Angle#)

Print Result#
Print FastCalcResult#


print "--------------------------- TIMING -------------------------"


max=100000

t=timer()
for lp =0 to max
Result#= Rnd(Angle#) * Radius#
Result#= Rnd(Angle#) * Radius#
Result#= Rnd(Angle#) * Radius#
Result#= Rnd(Angle#) * Radius#
Result#= Rnd(Angle#) * Radius#

next

print timer()-t

t=timer()
for lp =0 to max
FastCalc FastCalcResult#=Radius# * Rnd(Angle#)
FastCalc FastCalcResult#=Radius# * Rnd(Angle#)
FastCalc FastCalcResult#=Radius# * Rnd(Angle#)
FastCalc FastCalcResult#=Radius# * Rnd(Angle#)
FastCalc FastCalcResult#=Radius# * Rnd(Angle#)
next
print timer()-t


t=timer()
for lp =0 to max
FastCalcResult#=Radius#+Radius#+Radius#+Radius#+Radius#
FastCalcResult#=Radius#+Radius#+Radius#+Radius#+Radius#
Login required to view complete source code

   



Download


  Newer builds bellow




kevin

#61
 PlayBASIC V1.64P3 BETA #16 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (16th Oct,2015)

     V1.64P3 Beta #16 this one includes another static opcode library conversion with the translation of the Pointer opcode set.    It also includes the updated Documentation from the previous build.  SO there's no need to download Beta 15 and Beta 16



Download


    Obsolete built removed, newer builds bellow



kevin

#62
 PlayBASIC V1.64P3 BETA #17 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (19th Oct,2015)

     V1.64P3 Beta #17 takes the static instruction set conversion one step futher with the tranlations the bit functions, which includes stuff like the shift/roll (LSR32, LSL32, ROR32, ROL32) the move operations, swapbyteorder, swapword etc  as well as the bit operations (SetBit,SwapBit etc etc).    We gain extra performance and drop from size from the runtimes.

     This zip also includes the Documentation and the EXE runtimes, so you can actuall build EXE's with this version, although it'll give you a warning if you do so..  Which in this case you can ignore since the compiler and runtimes do match (ie they're built with the same instruction sets...) where as normally that'd give undefined results, since there's no guarantee the two sides use the same instruction sets, nor would an old runtime include new fixes.  
         


Download


   Obsolete built removed, newer builds bellow

kevin

  PlayBASIC V1.64P3 BETA #18 -  Opcode translations Dynamic To Static Continues

      While hopefully while you guys have been testing revision/beta  17,  I've been pushing ahead with more translations harnessing every drop of speed from the legacy runtimes.    One example would the calling externally bound functions like those attached via LinkDLL blocks.

     On closer inspection at those linkdll opcode execution blocks there's some fat that can be trimmed from the calling process.  So that's been the focus of basically the last 24 hours of coding.  Resulting an almost doubling of performance of the benchmark (about 40% actually), but there's some odd stuff happening with the replacement code at this time.   There would seem to be some logical differences between them, so I unfortunately can't roll that out today.   

    anyway, back to it..               

kevin

#64
 PlayBASIC V1.64P3 BETA #18 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (28th Oct,2015)

     V1.64P3 Beta #18 continues with the migration to a static instruction set, with some conversions centering around the calling of linked DLL functions, such as functions defined within LinkDLL/EndLinkDll blocks.   The changes result in a performance boost of about 25% improvement when calling a test function million times.     This was further improved with the addition a some post processing done in the compiler to stream line the output values of such calls, which pushes the test to about 40->45% faster.   There's a few other things that can be done in the future, but  break compatibility at this time.

     This package includes ithe Documentation and the EXE runtimes.   So if you haven't updated to Beta17, you can skip that and just run this one.  Since this is a BETA build which as includes in the runtimes, you'll  get a warning when trying building an EXE from your project.    The warning can be  ignored since the compiler and runtimes do match (ie they're built with the same instruction sets...) where as normally that'd give undefined results, since there's no guarantee the two sides use the same instruction sets, nor would they include new fixes.  
       

Download


   Obsolete beta removed




kevin

#65




PlayBASIC V1.64P3 _Retail Upgrade_ Now Available (20th, Nov, 2015)



  This release updates any version from  PlayBASIC  V1.63w2 to PlayBASIC V1.64P2 (retail) to the current retail version of PlayBASIC V1.64P3.   If your current version is older than PB1.63W (pre June/July 1997), then you may need to install patch PB1.63w2 prior to this one ! (if you haven't already)


   The PlayBASIC V1.64P3  package includes updates of PlayBASIC Compiler, Release / Debug Runtimes, SLIBS,  DOCS & IDE V1.17b.  

   The V1.64P3 release includes fixes for known functionality breakages during the massive V1.64P/V1.64P3 update.   But like all updates that's not the only thing it includes, with a lot of work being done under the hood with the compiler / runtimes in the way of more dynamic to static byte code navigation.   Which includes translations of thing like the DLL command block as well as pointer instruction sets and a number of others.  For more information about those read the blog thread.



   Don't have a retail version of PlayBASIC ? and want to find out more information about PlayBASIC programming > please visit the www.PlayBasic.com and download the free learning edition.





Downloads


  Download PB1.64P3 Retail Upgrade (login required)  (20th,Nov,2015)


kevin

#66
 PlayBASIC V1.64P4 BETA #1 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (7th Dec,2015)

     V1.64P4 Beta #1 tweaks the pre-processing a little and adds from nanny code for scene depth control, which should stop most overflows, but can't stop all of them.  

       

Download


  Old beta remove, newer builds bellow


kevin


   Shifty Operators   

      While working on some sorting algos this morning, noticed a problem the LSR  (and >>) operations in newer VM's which are found in the last couple of builds.  It occurs from the static opcodes replacements made in those revisions which have  since been fixed.  The issue was simply some the operation was doing an arithmetic shift rather than a bit wise shift, which is  how it's defined originally. 

      So for the time being and depending upon your version, this will either return the correct answer of  $0000ffff or the wrong answer of $ffffffff

PlayBASIC Code: [Select]
   a=$ffff0000
print hex$( a>> 16)
sync
waitkey




     In the code i was having trouble with was doing a AND then a SHIFT,  something like this

     Result  =  ThisValue And MASK >> Shift     

      all i needed to do is flip that..   SHIFT  then MASK off any nwanted bits




kevin

#68
   PlayBASIC V1.64P4 BETA #5 - String Sorting  - 250000 strings per second  

   Been working on various sorting algorithms which are used in the internals of the PlayBASIC runtimes, originally the replacement routines only handled integer/float data,  but I've since managed to build a version that will work on string arrays also.

   The command set uses string sorting a number of commands, but these are generally  hidden deep away and often uses combination pre-passes with the sorting to speed them up.   The one exception of course, is found in the  SortArray command, which uses a classic Quick Sort implementation.  Which is ok on small sets but chokes on the bigger sets of strings.   While I suspect some of the choking is by product of my legacy implementation :), it's just doesn't cut it for big sets of data...

   The replacement code is what I calla freq sort, it's a none comparative sort, which just means its skim through on various key, where it rearranges on those keys and then repeats the process until all keys have been passed.    Once you get to end of the final sweep the array should be in order.    The only issue really is that the ordering in case incentive,  so  AAAA    and aaaa would have equal precedence in the output.



    So performance,

        Ok.... In the previous builds, the SortArray command can only handle about 800 variables length strings (1 to 32 characters) per second on my test machine per 1000->1100 millisecond gap.    

        Compare that to todays version that can handle 250,000 variable length strings (1 to 32 characters)  in the 1000->1100 millisecond range...

        That's approximately 312 times faster..   Which doesn't happen every day !



kevin

#69
 PlayBASIC V1.64P4 BETA #6 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (2nd Feb,2016)

     V1.64P4 Beta #6 contains a few bugs and tweaks as well as include the new sorting routines used in the SortArray() command, making the command much much much much faster than before...   For example it'll handle 250000 strings in about 1.1 seconds,  which in not too bad for the old althon test machine.    

     Read V1.64P Update Work In Progress gallery


PlayBASIC Code: [Select]
      r      =123456
Size =25000

Dim Table(Size+1)
Dim TableCopy(size+1)

For lp=0 to Size
Table(lp)=rnd(r)
TableCopy(lp)=Table(lp)
next

; init arrays of floats
Dim f#(Size)
Dim f2#(Size)
For lp=0 to Size
f#(lp)=rndrange#(-r,r)
next


; init the string array with random strings
Dim s$(Size)
Dim s2$(Size)
Init_String_Arrays(Size)


maxtests=1

Do

cls
frames++

Test_Integer_Sorting_Speed(Size,Frames)

Test_Float_Sorting_Speed(Size,Frames)

Test_String_Sorting_Speed(Size,Frames)

Sync
loop





psub Test_Integer_Sorting_Speed(Size,Frames)

print "---------------------------------------"
print "Number of Integers:"+str$(Size)
print "---------------------------------------"

t=timer()
copyArray TableCopy(),Table()
tt1#+=timer()-t
print " Copy Array Time:"+str$((tt1#/frames))


t=timer()
sortArray Table(),0,Size
tt2#+=timer()-t
print " Freq Sort Time:"+str$((tt2#/frames))
print ""
ENdPsub



psub Test_Float_Sorting_Speed(Size,Frames)

print "---------------------------------------"
print " Number of Floats:"+str$(Size)
print "---------------------------------------"

t=timer()
copyArray f#(),f2#()
tt1#+=timer()-t
print " Copy Array Time:"+str$((tt1#/frames))


t=timer()
sortArray f2#(),0,Size
tt2#+=timer()-t
print " Freq Sort Time:"+str$((tt2#/frames))

print ""

ENdPsub


Psub Test_String_Sorting_Speed(Size,Frames)


print "---------------------------------------"
print " Number of Strings:"+str$(Size)
print "---------------------------------------"

// Copy the array to a temp string
; VM_SortArrayMethod(1)

t=timer()
copyarray s$(),s2$()
tt1#+=timer()-t
print " Copy Array Time:"+str$((tt1#/frames))

t=timer()
sortArray s2$(),0,Size
tt2#+=timer()-t
print " String Sort Time:"+str$((tt2#/frames))
print ""

EndPsub





Psub Init_String_Arrays(Size)

Dim s$(Size)
Dim s2$(Size)

// fill the string array with random strings
// ranging in size from 1 to 32 characters

for lp=0 to Size
s$=""
for l=0 to 1+(lp and 31) ;rndrange(10,100)
if rnd(100)>50
ThisChr=asc("a")+rnd(asc("z")-asc("a"))
else
ThisChr=asc("A")+rnd(asc("Z")-asc("A"))
endif
s$+=chr$(THisCHR)
next
s$(lp)=s$
next

EndPsub






       

Download


     Obsolete beta removed





kevin

#70
 PlayBASIC V1.64P4 BETA #7 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (24th Feb,2016)

     V1.64P4 Beta #7 includes the first edition of the PlayBASIC image format (PBI).   The user command set now supports it though the normal LoadImage style commands when loading from disc, there's no support for loading from memory as yet.    This package also includes a new SLIB called SavePBI which is simple saver library.




Download

 
   old file removed, newer build bellow




kevin

 PlayBASIC V1.64P4:  The final days

    Getting back to time work (after that unfortunate real life distractions of the past couple of weeks)  on what I hope will be final V1.64 revision ever!    The latest focus has been tweaking PBI conversion code, adding a PBI analysis interface and the inclusion of loading from memory support to the command set.    All of which went relatively painlessly.

   The next little chore on the agenda is another tweak round over the doc's,  you know include the newest stuff, tweak old examples etc etc.   Not going to bother with the project pack as nobody even looks at them.   Will probably post the latest build in the new few days and if the sky doesn't fall, that'll be it.



kevin

 PlayBASIC V1.64P4 BETA #8 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (14th Mar,2016)

      V1.64P4 Beta #8 is the final clean up, including some library tweaks & help tweaks.



Download


   Download PlayBASIC V1.64P4 Beta8 (login required)  (14th,Mar,2016)




ATLUS


kevin





PlayBASIC V1.64P4 _Retail Upgrade_ Now Available (24th, Mar, 2016)


   The PlayBASIC V1.64P4  package includes updates of PlayBASIC Compiler, Release / Debug Runtimes, SLIBS,  DOCS & IDE V1.17b.  

   The V1.64P4 revision introduces the PBI (PlayBASIC Image format) as well as including a round of documentation and bug tweaks.   For more information about those read the blog thread.


   Don't have a retail version of PlayBASIC ? and want to find out more information about PlayBASIC programming > please visit the www.PlayBasic.com and download the free learning edition.





Downloads


  Download PlayBASIC V1.64P4 Retail Upgrade (login required)  (24th,Mar,2016)