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
LÖVE 11.5 game engine has switched over to using LuaJIT by default. This causes Balatro to /constantly/ JIT code through code invalidations.
This is due to how LuaJIT compiles, it allocates 128KB at the start, and each time it generates new JIT code it changes permission of the code segment to RW for the full range, JITs code by appending to the end, and then changes back to RX. This causes FEX to invalidate all code in that mapping and spend all CPU time JITTing the same code over and over. This drops the game to sub 1FPS.
If we recognize that a region is a JIT region and do partial invalidations this will significantly improve the situation.
We could do this by:
hashing a JIT region code upfront (xxhash likely)
On invalidation just remove jump entries
On JIT, just do a lookup and hash check to put the entry back in JIT
This will have a bit of stampeding in the JIT after each invalidation, but better than full reJIT.
The text was updated successfully, but these errors were encountered:
LÖVE 11.5 game engine has switched over to using LuaJIT by default. This causes Balatro to /constantly/ JIT code through code invalidations.
This is due to how LuaJIT compiles, it allocates 128KB at the start, and each time it generates new JIT code it changes permission of the code segment to RW for the full range, JITs code by appending to the end, and then changes back to RX. This causes FEX to invalidate all code in that mapping and spend all CPU time JITTing the same code over and over. This drops the game to sub 1FPS.
If we recognize that a region is a JIT region and do partial invalidations this will significantly improve the situation.
We could do this by:
This will have a bit of stampeding in the JIT after each invalidation, but better than full reJIT.
The text was updated successfully, but these errors were encountered: