I've recoded some old Blitz plus stuff into Bmax. Didn't use bbconv, just did it by hand. My program's a rigid body engine, but it runs a lot slower under Bmax! I ahven't tried to do anything clever with the re-write so there's little difference in the code. Narrowed time difference down to one main routine....
18 ms for 40 circles in bmx
2ms for 40 circles in B+. Any help/suggestions appreciated.
Function circle_constraints() 'Attempts To move all circles out of collision Local c:circle ' circle Local cc:circle ' circle tested For col with c=c_list._head While c cc=c_list._head While cc If (c<>cc) Local coldist#=c.rad+cc.rad Local d#=Sqr((cc.x-c.x)^2.0+(cc.y-c.y)^2.0) If d<coldist Local mx#=(coldist-d)*(c.x-cc.x)/d Local my#=(coldist-d)*(c.y-cc.y)/d c.x=c.x+mx/2.0 c.y=c.y+my/2.0 cc.x=cc.x-mx/2.0 cc.y=cc.y-my/2.0 EndIf EndIf cc=cc._next Wend c=c._next Wend Return End Function
18 ms for 40 circles in bmx
Function circle_constraints() ;Attempts to move all circles out of collision Local c.circle ; circle Local cc.circle ; circle tested for col with For c=Each circle For cc=Each circle If (c<>cc) Local coldist#=c\rad+cc\rad Local d#=Sqr((cc\x-c\x)^2+(cc\y-c\y)^2) If d<coldist Local mx#=(coldist-d)*(c\x-cc\x)/d Local my#=(coldist-d)*(c\y-cc\y)/d c\x=c\x+mx/2. c\y=c\y+my/2. cc\x=cc\x-mx/2. cc\y=cc\y-my/2. EndIf EndIf Next Next Return End Function
2ms for 40 circles in B+. Any help/suggestions appreciated.