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
It occurred to me that in a lot of targets we now have around 5000 variables, but we're using 16 bit references - so a few bits are being lost.
Not only that but on the <1024 byte targets we're using up some JsFlags bits to store reference info, and those would be amazingly useful for some more global flags like visible/const/etc.
So I just had a quick go at throwing GCC's packed bits at it, and... it works!
This only works in GCC 4.4 and later it seems because they improved the bit packing behaviour, but for something like Puck.js (2250 vars) it drops the var size from 16 to 13 bytes, allowing you to bump the available vars to 2769.
Obviously this destroys alignment, so I'm unsure of how well (or quickly) this'll work, but it's an interesting start.
Just to add: strangely this is actually less efficient for normal Strings, which now only store 9 bytes of characters for a 13 byte variable, where before they managed 12 bytes out of 16. However Espruino tries to allocate flat strings where it seems sensible, so it's less of a big deal.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
It occurred to me that in a lot of targets we now have around 5000 variables, but we're using 16 bit references - so a few bits are being lost.
Not only that but on the <1024 byte targets we're using up some JsFlags bits to store reference info, and those would be amazingly useful for some more global flags like visible/const/etc.
So I just had a quick go at throwing GCC's packed bits at it, and... it works!
https://github.com/espruino/Espruino/tree/experimental_compact_vars
This only works in GCC 4.4 and later it seems because they improved the bit packing behaviour, but for something like Puck.js (2250 vars) it drops the var size from 16 to 13 bytes, allowing you to bump the available vars to 2769.
Obviously this destroys alignment, so I'm unsure of how well (or quickly) this'll work, but it's an interesting start.
Just to add: strangely this is actually less efficient for normal Strings, which now only store 9 bytes of characters for a 13 byte variable, where before they managed 12 bytes out of 16. However Espruino tries to allocate flat strings where it seems sensible, so it's less of a big deal.
The text was updated successfully, but these errors were encountered: