I am using BGlib in my imp 002 and It is hitting program storage limits.
From existing threads I got to know that there was feature to compress the bytecode.
What is the current status of this feature?
What kind of optimization I can do in BGLib to reduce the program storage?
Right now it’s still a bit DIY as far as code reduction goes, though there is good news on the horizon for you and others using a lot of your code space.
In the meantime, you can “manually optimize” by deleting methods you don’t call. Not terribly fun, but if it gets you moving forward again it might be worth it.
Are we looking at https://gist.github.com/blindman2k/11353842 ?
There’s a lot of strings in that code that are only used for debugging: all the command and event names, for instance. It’d be more memory-efficient (though less convenient) to always represent commands by their two-byte cid/cmd values, and then if you ever wanted to understand your logs in terms of command and event names, postprocess the logs to replace the two-byte identifiers by the human-readable names.
With a bit more effort it might be possible to replace all the event parsing with some kind of table-driven lookup (hinted at by BLE_PARAMETER_TYPES). And there’s never any need for format("%c",ch) – that’s just ch.tochar().