News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

PlayBASIC V1.65 (Work In Progress) Gallery

Started by kevin, April 03, 2016, 12:01:41 AM

Previous topic - Next topic

kevin

#90
PlayBASIC V1.65C2 BETA #15 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (8th July,2020)

     V1.65C2 Beta #15 is the current build of the compiler and runtimes.    This includes parser updates to handle IF a$ expressions, IF ARRAY() and corrects the NEW operator.


     Anyway, have fun..




Bug Reporting


    See->> PlayBASIC V1.65 Bug Reports (login required).


       

Download



  Download PlayBASIC V1.65C2 Beta15 (login required)  (8th,July,2020)




kevin


  PlayBASIC V165C2 - Warning - Possible Memory Leak in debug mode

   Not sure what's the cause here is, but would seem either UNDIM or DIM are leaking some handles here, as if you run in debug mode (F7) and watch the handle allocations it keeps raising each time the loop runs.  I think it's caused from the updates make to DIM / UNDIM which try and cache buffers..  we'll see


PlayBASIC Code: [Select]
   type tParams
Name$
Value$
EndType


makearray p().tParams


for lp =0 to 100


count=100
dim p(count) as tParams
for testlp=0 to count
p(testlp) = new tParams
p(testlp).Name$ ="Name"+str$(z)
p(testlp).value$ ="Value"+str$(z)
z++

next

handle = GetHandle(p())
print handle

deletearray p()

p() = handle

#break
undim p()

next

print z

sync
waitkey


function GetHandle(p() as tParams)

EndFunction p() as tParams





     Another way of doing this is to use a 'text' heap and store the types in a chunk of memory with links between the cells or just in a global string array.    Which I think should be OK in V165.. but haven't done the analysis to back that up as yet... 





kevin

#92
   UNDIM doesn't support types or lists


     Ok, well there's nothing like opening up the runtime and discovering this...  Apparently UNDIM only supports INTEGERS / FLOATS AND STRINGS, TYPES and LISTS aren't supported at all ..  Hence the memory leaks..   Funny that :)

kevin

     UNDIM restored in build 16

        This turned out to be just some missing support in UNDIM,  Also added support to clean up any associated linked lists within type variables.   There does seem to be a leak if you DIM in a loop though.  But I suspect it's just not calling clean up the old buffer if it exists.   Ideally it should try and manage / buffer those allocations to avoid some memory thrashing,  which is what was partly implemented into the DIM revisions way back in 2016, but the  fate stepped in..  


PlayBASIC Code: [Select]
   type tParams
Name$
Value$
EndType



// Test lists
for tests=0 to 100
cls
Dim L as tParams List

for lp=0 to 10
L = new tParams
l.Name ="Hello"+Str$(lp)
l.Value ="World"+Str$(lp)
next


for each l()
print l.Name+" "+l.value
next
sync

// remove to the see the leak in the debug mode
undim l()
#break

next
waitkey










kevin


PlayBASIC V1.65C2 BETA #20 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (17th March,2021)

      V1.65C2 Beta #20 is the current build of the compiler and runtimes.      This build includes some compiler WARNINGS for programs that use Optexpressions  in particular mode 2 which is type caching.  Type caching isn't supported in V1.65 for the time being,  and if it's enabled can break programs hence the warning.   Disabling it makes big programs I'd been testing ran again.   

      Other fixes relate to the fonts library when using classic bitmap fonts. 


      Anyway, have fun..



Bug Reporting


     See->> PlayBASIC V1.65 Bug Reports (login required).


         

Download



   Download PlayBASIC V1.65C2 Beta20 (login required)  17th,MArch,2021)




kevin

#95



PlayBASIC V1.65C2 _Retail Upgrade_ Now Available (10th, July, 2021)


  This release updates any version from  PlayBASIC   V1.63w2 to PlayBASIC V1.65C (retail) to the current retail version of PlayBASIC V1.65C2.   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, otherwise there's no need.

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


   Reminder: The new runtime doesn't support reading from types that don't exist,  which can cause old programs to fail from time to time..  For a full V1.65C development story read the PlayBASIC V1.65 blogs here and for V1.65 related errors, post them in the V1.65 bug reporting thread (login required).  



   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.65C2 Retail Upgrade (login required)  (10th,July,2021)   (No download managers!)




kevin




PlayBASIC V1.65C2b _Retail Upgrade_ Now Available (12th, Sep, 2021)


   This release updates any version from  PlayBASIC  V1.63w2 to PlayBASIC V1.65C (retail) to the current retail version of PlayBASIC V1.65C2b.   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, otherwise there's no need.

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


    Reminder: The new runtime doesn't support reading from types that don't exist,  which can cause old programs to fail from time to time..  For a full V1.65C development story read the PlayBASIC V1.65 blogs here and for V1.65 related errors, post them in the V1.65 bug reporting thread (login required).   



    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.65C2b Retail Upgrade (login required)  (12th,Sep,2021)   (No download managers!)




kevin



  PlayBASIC V1.65D    -  Bug fixes and some more simple Vector operations built in.



    Fired up the dev box for the first time in month or so to be reminded of the last WIP update that was started months ago wasn't running. Apparently  I couldn't recall how to add command to PB's internal command set..   Which is way too complicated due to excessive hackie-ness of the various changes that have been to that stuff over the past 15 years...  Yeah it's really time for a rewrite all that...   

    None the less there's an internal Lenght2D / Length3D and Dot Product 3D in place at the moment.   


    While on the subject of Vectors,  I think if 2D/3D vector types were built in,  the parameter matching could would with legacy commands..   So rather than PositionSprite Index,X#,y#   you could  PositionSprite Index, PositionVector2D   where the position vector 2d variable is a typed structure that you've been working with in other calcs..   The caller would unwrap the parameters, but would save some boiler plate. 

   so PositionSprite Index, PositionVector2D

   PositionSprite Index, PositionVector2D.X, , PositionVector2D.Y
 
   PositionSprite Index, PositionVector2D

kevin

#98
PlayBASIC V1.65C3 - Beta 2 - Faster Math operations (some)

    The math operations are a mixture of libraries and code boiled into the legacy runtime..  Trying to tweak this today is a little more mind bending than I'd expected..  but  we're making some progress..

     Changes thus far are to the GetDistance2D / GetDistance3D / Point In Box functions..   Which have been replaced with a more stream lined versions. Which just means it calls the pattern directly.  Performance wise there's from 20% up to 50% faster.    It was possible before (1.65 editions) to roll your own distance function that could out perform the built in function.   Which pre 1.65 was unthinkable, but all those real basic operations are now are about as lean and mean as can be (until I have another brain wave :) )  meaning rolling your own could be better..   But not anymore.



kevin

#99

     PlayBASIC V1.65C3 - Beta 3 - A few more Faster Math operations (some)


        Replaced the point in circle and circles intersect   which should be overlap, since it doesn't output the intersection points..   but moving along :)


        See: CirclesIntersect

        See: PointIntersectCircle




kevin

#100
 PlayBASIC V1.65C3 BETA #4 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (31st July,2022)

     V1.65C3 Beta #4 is the current build of the compiler and runtimes.      This build fixes the screen mode start up bug and includes the getLenght2D  GetLenght3D   DotProduct3D  and some replacements of classic math intersection functions..    


     Anyway, have fun..

       

Download



  Download PlayBASIC V1.65C3 Beta 4 (login required)  31st,July,2021)




PlayBASIC Live


   



   Learn To Code @  PlayBASIC  Home Page
   https://playbasic.com/


   PlayBASIC manual - PlayBASIC Documentation - PlayBASIC Help
   https://playbasic.com/help.php





Vector Test Benchmark


PlayBASIC Code: [Select]
; PROJECT : 2D vector functions Benchmarks
; AUTHOR : PlayBASIC Tutor
; CREATED : 1/01/2003
; EDITED : 31/07/2022
; ---------------------------------------------------------------------

constant TestNewVectors = false

cls 0
print "Waiting Vector Functions"
sync
For lp=0 to 5
sync
wait 500
next

Dim TestArrayInt(1000)
Dim TestArrayFloat#(1000)

Dim Results#(100)
TestStart=Timer()


MaxTests=20000

Repeat

Cls 0
frames=frames+1

Test=0
Print "Displaying Average Times for "
;+str$(Maxtests)+" Tests"

Print "Current Frame:"+Str$(frames)

x#=50
y#=100
z#=200

temp=0


ts=Timer()
For i = 0 To MaxTests
result# = sqrt(x#*x# + y#*y#)
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "Compute Lenght2D:"+Str$(results#(test)/frames)+" Result="+str$( result#)
test=test+1


#if TestNewVectors = true
ts=Timer()
For i = 0 To MaxTests
result# = getlenght2d(x#,y#)
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print " GetLenght2D:"+Str$(results#(test)/frames)+" Result="+str$( result#)

test=test+1
#endif

; -------------- [3D ] ---------------------------------------------------

ts=Timer()
For i = 0 To MaxTests
result# = sqrt(x#*x# + y#*y# + z#*z#)
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "Compute Lenght3D:"+Str$(results#(test)/frames)+" Result="+str$( result#)
test=test+1


#if TestNewVectors = true

ts=Timer()
For i = 0 To MaxTests
result# = getlenght3d(x#,y#,z#)
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print " GetLenght3D:"+Str$(results#(test)/frames)+" Result="+str$( result#)
test=test+1
#endif





x1#=100
y1#=100
z1#=100

x2#= x1#*2
y2#= y1#*2
z2#= z1#*2



ts=Timer()
For i = 0 To MaxTests
dx#=x2#-x1#
dy#=y2#-y1#
dz#=z2#-z1#

result# = sqrt(dx#*dx# + dy#*dy# + dz#*dz#)
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "Compute GetDistance3D:"+Str$(results#(test)/frames)+" Result="+str$( result#)
test=test+1


ts=Timer()
For i = 0 To MaxTests
result# = getDistance3d(x1#,y1#,z1#,x2#,y2#,z2#)
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print " GetDistance3D:"+Str$(results#(test)/frames)+" Result="+str$( result#)
test=test+1


ts=Timer()
For i = 0 To MaxTests
result = PointInBox(200,200,1000,1000,50,50)
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print " POintInBox:"+Str$(results#(test)/frames)
test=test+1



x1#=100
y1#=100
z1#=10

x2#=150
y2#=150
z2#=100

ts=Timer()
For i = 0 To MaxTests
dx#=(x1#-x2#)
Login required to view complete source code



kevin

#101
 PlayBASIC V1.65C3 BETA 5  - Concatenating Strings  


 Updated the PlayBASIC string engine tonight to better balance the load when strings get really large.   This test originally took 20 odd seconds to build a 100 million character string, character by character..   while this update does it in about 2 seconds..  

 You're welcome ! :)


 
PlayBASIC Code: [Select]
      max= 1000*1000*100

t=timer()
for lp =1 to max
result$=result$+"*"
next

print timer()-t
print len(result$)


// Time MAKE$() :)
t=timer()
REsult2$=Make$("*",max)
print timer()-t
print len(result2$)


print "CompareState:"+Str$(Result$=REsult2$)

sync
waitkey







kevin

#102
 PlayBASIC V1.65C3 BETA #5b (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (3rd May,2023)

     V1.65C3 Beta #5 is the current build of the compiler .    -  This will report that it's Beta 4 also..  Just ignore that!  

      This build corrects OpenScreen / GetScreenTitle/ ScreenTitle so they preserve the title regardless of the window mode.   Previously the Screen Title functions would only work in windowed mode.  Now they just store the title string and only set the window title if there's a window to set.  

PlayBASIC Code: [Select]
   TitleScreen  "This is my screen title"
openscreen 800,200,32,1
sync
wait 1000



openscreen 500,500,32,1
sync
waitkey






      This build also includes some optimization to the string engine when concatenating large strings.   Smaller strings shouldn't be impacted by the change, it just expands the target string more aggressively when a larger amount is needed.  


PlayBASIC Code: [Select]
   Size=1000*1000

t=timer()
for lp=1 to Size
Result$=Result$+"*"
next
print "Ticks:"+str$(Timer()-t)
print Len(Result$)
print ""


// COmpare it to Make$()
t=timer()
Result2$=Make$("*",Size)
print "Ticks:"+Str$(Timer()-t)
print Len(Result2$)
print ""

// Compare them
t=timer()
State=result$=Result2$
print "Ticks:"+Str$(Timer()-t)
print State
print ""

Sync
waitkey







     Anyway, have fun..



Bug Reporting


    See->> PlayBASIC V1.65 Bug Reports (login required).


       

Download


  Download PlayBASIC V1.65C3 Beta 5b (login required)  (3rd,May,2023)   This build will report as Beta 4..  


kevin

#103
PlayBASIC Blog -  Array Functions   Find Array Cell   Palette Mapping Test

 In this blog i'm using some palette mapping code to looking the performance of the general Array Functions in PlayBASIC V1.65; namely the performance of the FindArrayCell function when doing brute force searches..  Which is ok; but I feel could be a lot better.


 



  Help Files:

   -  Array Functions In PlayBASIC

kevin

#104
 PlayBASIC V1.65C3 - Beta 6  - Faster Numeric Comparisons  

     After setting up a real standing desk for the PB dev box I was sifting through the layout of the current instruction sets;  looking for ways to help the runtime win back some performance without having to jump in and re-write heaps of stuff.  I generally don't like to do that as one you open the can of worms it can be hard to put the genie back in bottle..   Something keep bothering me though, numeric comparisons, surely they can blocked with the other low level simple integer and floating point operations;  so that's what I set out to do..  

    Here's the rough results

    Pb165C3 - Beta #6  = 8.9 seconds
    Pb165C3 - Beta #5  = 20 seconds
    Pb164P4 -  Retail     = 32 seconds
    Pb164L  - Learning Edition     = 67 seconds

    Set screenshots bellow..  


 PlayBASIC  DevBlog  - Faster Numeric Comparisons  

 




 PlayBASIC  Source Code

   
PlayBASIC Code: [Select]
; PROJECT : Comparison_Bench_Mark
; AUTHOR : uwdesign
; CREATED : 26/04/2004
; EDITED : 27/07/2023


cls 0
print "Compares Waiting"
sync
For lp=0 to 5;
wait 1000
next


Dim Results#(100)
TestStart=Timer()



MaxTests=100000


Repeat

Cls 0
frames=frames+1

Test=0
Print "Displaying Average Times for "
;+str$(Maxtests)+" Tests"

Print "Current Frame:"+Str$(frames)

temp=0

ts=Timer()
For i = 0 To MaxTests
temp=A=B
temp=A=B
temp=A=B
temp=A=B
temp=A=B
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "For Next: = : INT=INT:"+Str$(results#(test)/frames)
test=test+1


ts=Timer()
For i = 0 To MaxTests
temp=A=B#
temp=A=B#
temp=A=B#
temp=A=B#
temp=A=B#
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "For Next: = : INT=FLT:"+Str$(results#(test)/frames)
test=test+1



ts=Timer()
For i = 0 To MaxTests
temp=A#=B
temp=A#=B
temp=A#=B
temp=A#=B
temp=A#=B
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "For Next: = : FLT=INT:"+Str$(results#(test)/frames)
test=test+1

ts=Timer()
For i = 0 To MaxTests
temp=A#=B#
temp=A#=B#
temp=A#=B#
temp=A#=B#
temp=A#=B#
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "For Next: = : FLT=FLT:"+Str$(results#(test)/frames)
test=test+1



ts=Timer()
For i = 0 To MaxTests
temp=A<>B
temp=A<>B
temp=A<>B
temp=A<>B
temp=A<>B
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "For Next: <> : INT=INT:"+Str$(results#(test)/frames)
test=test+1


ts=Timer()
For i = 0 To MaxTests
temp=A<>B#
temp=A<>B#
temp=A<>B#
temp=A<>B#
temp=A<>B#
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "For Next: <> : INT=FLT:"+Str$(results#(test)/frames)
test=test+1


ts=Timer()
For i = 0 To MaxTests
temp=A#<>B
temp=A#<>B
temp=A#<>B
temp=A#<>B
temp=A#<>B
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "For Next: <> : FLT=INT:"+Str$(results#(test)/frames)
test=test+1


ts=Timer()
For i = 0 To MaxTests
temp=A#<>B#
temp=A#<>B#
temp=A#<>B#
temp=A#<>B#
temp=A#<>B#
Next i
t=Timer()-ts
Results#(test)=results#(test)+t
Print "For Next: <> : FLT=FLT:"+Str$(results#(test)/frames)
test=test+1



Login required to view complete source code

 


    It's important to note that this is a specialized test;  for this to have real impacts on your code you'll need to be doing a lot of comparisons.  

    One example where this shines through are things like PlayBASIC Vector Blast Processing (2023-06-23)  which runs about 4->5 fps faster in beta 6 on my test machine.  



   Download PlayBASIC V1.65C3 - Beta 6


    Download PlayBASIC V1.65C3 Beta 6 (login required)