Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

My Suggestion how to contribute to improve upon the compile feature #1106

Copy link
Copy link
@franzhaas

Description

@franzhaas
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.