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

Memoize should_trace for faster execution #21

Merged
merged 1 commit into from
Jan 17, 2020

Conversation

groutr
Copy link
Contributor

@groutr groutr commented Jan 16, 2020

This PR caches the output of should_trace which yields a slight performance increase.
Running the julia1_nopil.py benchmark on my laptop:
master: 8.14s
memoize_shouldtrace: 7.98s

Running the benchmark and looking a the cache statistics shows that the cache is hit 530 times for 1 file.

should_trace can perform two string searches before returning a result. os.path.abspath isn't exactly the speediest function either. Caching the results of should_trace makes a lot of sense.

I used the LRU cache available in the standard library. I feel the default maxsize of 128 is sufficient.

@emeryberger emeryberger merged commit c7de3f0 into plasma-umass:master Jan 17, 2020
@emeryberger
Copy link
Member

Good catch. Thanks!

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.

2 participants