Skip to content

Speed up generated decoder compilation times #300

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

Merged
merged 10 commits into from
Feb 13, 2020

Conversation

evnu
Copy link
Member

@evnu evnu commented Jan 28, 2020

This pull request speeds up compilation by extracting common code from field assignments into helper functions, and by preferring local variables for initial assignment instead of assigning struct fields directly. See #299 for the corresponding issue.

Fix #299.

@evnu
Copy link
Member Author

evnu commented Jan 29, 2020

Some benchmark results from running meta_benchmark.sh in https://github.com/evnu/rusty/tree/master/native/benchmark_compile.

~/tools/rusty/native/benchmark_compile(master ✗) ./meta_benchmark.sh
Derive Type master 299-speed-up-decoder-compilation
NifMap NifMap_master NifMap_299-speed-up-decoder-compilation
NifStruct NifStruct_master NifStruct_299-speed-up-decoder-compilation
NifRecord NifRecord_master NifRecord_299-speed-up-decoder-compilation
NifTuple NifTuple_master NifTuple_299-speed-up-decoder-compilation

This looks very promising. I was not yet able to refactor NifRecord and NifTuple to achieve a similar speed up. The problem is that we need to introduce let assignments for the fields, but with tuple structs we do not have a field name available to name the let variable.

@evnu evnu force-pushed the 299-speed-up-decoder-compilation branch from edce65e to 2c36dee Compare January 29, 2020 13:31
@evnu
Copy link
Member Author

evnu commented Jan 29, 2020

I managed to use let for tuple and records as well and squashed it into 2c36dee. Now, compilation is fast for NifTuple and NifRecord as well:

Derive Type master 299-speed-up-decoder-compilation
NifRecord NifRecord_master NifRecord_299-speed-up-decoder-compilation
NifTuple NifTuple_master NifTuple_299-speed-up-decoder-compilation

@evnu evnu marked this pull request as ready for review January 29, 2020 13:41
@evnu evnu requested a review from a team January 29, 2020 13:42
@evnu evnu merged commit bf705e3 into rusterlium:master Feb 13, 2020
@evnu evnu deleted the 299-speed-up-decoder-compilation branch February 13, 2020 07:43
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.

Compile time scales non-linearly with number of fields in structs
3 participants