You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As we still try to play around with "box2D" various impacts I used "wookie's" (@luk22) sample code to try out things.
It does some box2d stuff --- and the interesting part I added was the simple allocation of various TBanks in a global (not more not less)
So in essence I had this in the top area of the test file:
Global bankMode:int = 1
'modes
'0= 0 banks
'1= 120 * (1920 * 1080 * 4)
'2= 1200 * (1920 * 108 * 4)
'3= 12000 * (192 * 108 * 4)
Global banks:TBank[]
Global banksSize:int
Global banksAmount:int = 0
Select bankMode
case 0
banksSize = 0
banksAmount = 0
case 1
banksSize = 1920*1080*4
banksAmount = 120
case 2
banksSize = 1920*108*4
banksAmount = 1200
case 3
banksSize = 192*108*4
banksAmount = 12000
End Select
banks = new TBank[banksAmount]
For Local i% = 0 To banks.length - 1
banks[i] = CreateBank(banksSize)
Next
I modified the classic box2d in another module copy to have additional GetPosition2(vec:b2vec var) and the likes to save some "object creations" by just being able to reuse existing vectors.
Another version used @HurryStarfish 's version which skipped the required bvec2-object deletion too (think by having a bit of memory in a struct in which the box2d-lib writes their stuff or so). This truncated down the GC object allocation count quite a lot
The following list contains the maximum FPS the box2d sim had on my computer (ryzen 5 3600x)
So: physics.box2d is now faster than before. And the test somehow exposes, that the GC has issues with certain object amounts (almost same "total memory" required but somehow the "small blocks but many objects" gives more FPS
So the first two columns expose that there might be "sweet spots" in which the GC does change behaviour or so.
As we still try to play around with "box2D" various impacts I used "wookie's" (@luk22) sample code to try out things.
It does some box2d stuff --- and the interesting part I added was the simple allocation of various TBanks in a global (not more not less)
So in essence I had this in the top area of the test file:
I modified the classic box2d in another module copy to have additional
GetPosition2(vec:b2vec var)
and the likes to save some "object creations" by just being able to reuse existing vectors.Another version used @HurryStarfish 's version which skipped the required bvec2-object deletion too (think by having a bit of memory in a struct in which the box2d-lib writes their stuff or so). This truncated down the GC object allocation count quite a lot
The following list contains the maximum FPS the box2d sim had on my computer (ryzen 5 3600x)
So: physics.box2d is now faster than before. And the test somehow exposes, that the GC has issues with certain object amounts (almost same "total memory" required but somehow the "small blocks but many objects" gives more FPS
So the first two columns expose that there might be "sweet spots" in which the GC does change behaviour or so.
This might be the reason for the issue @luk22 has with his game (bmx-ng/bmx-ng#132)
I made a sample there: https://gist.github.com/GWRon/d478c10fd007d1e60364de05f4cbe295
(the first comment is adjusted for physics.mod/box2d.mod)
The text was updated successfully, but these errors were encountered: