Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed optimisations #1071

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft

Conversation

franzhaas
Copy link

Dear all,

I have been using construct for a while and engaged in a failed attempt to improve parsing speed in the past. (but I learned a lot trying...)

I believe I found a way to improve parsing speed significantly through several optimisations:

  1. Compile more constructs
  2. Inline optionals
  3. Compile enums to integers
  4. Combine struct.Struct calls
  5. Use a dictionary instead of Container object for as long as possible

Parsing is now 2-3x faster for my workload (stdf-tamer), and the compiled code is easier to understand and almost usable as a standalone module.

Allowing lambda/functions where normally can only be this expressions, would have made it much easier for me to use the compile feature, and this is included in this PR. I do believe that in some situations this expressions can not replace a function/lambda.

I would like to get some steering input, what of this effort is good/what needs to change before I would like to head on doing documentation and additional test coverage.

Best regards,
Franz

franz haas and others added 11 commits February 4, 2024 18:49
this is due to breaking changes in the way tests get
discovered which effect us
…strings any more.

Allwoing to mix Enum, int, and str makes it hard to do the
compiled code to do the same thing as the interpreted one.

I believe it is better for readability of the user code,
the compiler and basically everything between to not allow
that. Only int and enum types shall be used.
@franzhaas franzhaas force-pushed the speedOptimisations branch 2 times, most recently from 5c76f42 to 2c19955 Compare March 16, 2024 13:35
one more compiled item...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant