-
Notifications
You must be signed in to change notification settings - Fork 165
Description
I would like to contribute to the compile feature, and I would like to suggest to go about it like this.:
First, I took some time to understand the core.py module better. And my understanding of the compile feature reached a useful level. During this time I made a lot of experiments, the ideas listed here have shown usefulness during these experiments.
First steps
1.) A relatively large PR which does not allow exceptions in the compile step of the "common" test helper
(with only a view, explicit exceptions) #1105, adds python3.13, drops 3.8
2.) In the testbench, some tests are only performed with not compiled Structs, add a compile step there
3.) Many very small PRs which add _emitXXX methods where they are currently not available
4.) identify github projects using construct and use their testbenches to test the compiler
Longer term optimisations
with multiple Const in series
combine to one bigger Const, use a const byte array for checking/building
In Structs with multiple elements, and possibly fixed-sized Arrays
for fixed-size elements: combine multiple io.reads to a single read, combine multiple struct.unpack to a single struct.unpack
inline functions
In CPython (not in pypy) function calls are relatively expensive -> inlining is often easily possible
Create Container in a single step
Instead of repeatedly.: this["x"] = ...
do return Container({"x":...})
Optionally do not use Container, but dict, not ListContainer but list
after development is complete, the extra features of the Containers are often not used anymore.
@arekbulski @tomerfiliba @MostAwesomeDude
Please provide your opinions and guidance