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

Don't malloc-allocate rewriter lambdas #856

Merged
merged 2 commits into from
Aug 22, 2015
Merged

Don't malloc-allocate rewriter lambdas #856

merged 2 commits into from
Aug 22, 2015

Conversation

kmod
Copy link
Collaborator

@kmod kmod commented Aug 21, 2015

By adding a SmallFunction class that is similar to std::function but stores closure data inline rather than in a dynamic allocation.

           django_template3.py             3.0s (4)             2.9s (4)  -1.5%
                 pyxl_bench.py             2.7s (4)             2.6s (4)  -2.6%
     sqlalchemy_imperative2.py             3.1s (4)             3.1s (4)  -0.7%
                       geomean                 2.9s                 2.9s  -1.6%

@kmod kmod force-pushed the perf4 branch 2 times, most recently from 4978a83 to 546b0d3 Compare August 22, 2015 04:25
ie a simple bump-pointer allocator that will release all
of its memory when the rewrite itself gets deallocated.

Not a huge help itself, since most of the mallocs have been removed
from the rewriter, except for the std::functions which don't take
a custom allocator (at least not in libstdc++ 4.8 [and 4.9 I think]).
This commit works by adding a SmallFunction class that behaves
like std::function, but allocates its data inline rather than through
a separate allocation.  It probably could have also worked by taking
a custom allocator and using the new RegionAllocator.

It adds a bit more restrictions than std::function does (the types
caught by the closure have to be more "trivial" than std::function
supports), so some of this change is marking some types as trivial,
or copying data into a trivial format from things that aren't (ex SmallVector).
kmod added a commit that referenced this pull request Aug 22, 2015
Don't malloc-allocate rewriter lambdas
@kmod kmod merged commit d3fb236 into pyston:master Aug 22, 2015
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.

1 participant