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

10x faster task_local_memory #94

Merged
merged 1 commit into from
Jun 25, 2022
Merged

10x faster task_local_memory #94

merged 1 commit into from
Jun 25, 2022

Conversation

chriselrod
Copy link
Contributor

@chriselrod chriselrod commented Jun 25, 2022

This is better than it was before, but I'll follow up with another PR to use stack-allocated memory in many cases. That'll probably have to wait until Monday.

As for this PR, the old version was slow because adding type asserts on a function means to call convert and then to type-assert, while adding it on a function return only means to type assert.

Getting from an IdDict{Any,Any} of course infers as Any, which then means we need a dynamic dispatch to the convert. By only having the type assert, we instead get a fast check to confirm the type and then an error.
I left the type assert on the function as well, but as the type has now already been confirmed by the time the function returns, we have a static dispatch to convert (that gets compiled away, because it's already known to be the correct type).

@codecov
Copy link

codecov bot commented Jun 25, 2022

Codecov Report

Merging #94 (4b20efe) into main (3cda9f3) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #94   +/-   ##
=======================================
  Coverage   71.41%   71.41%           
=======================================
  Files          13       13           
  Lines        2316     2316           
=======================================
  Hits         1654     1654           
  Misses        662      662           
Impacted Files Coverage Δ
src/simple_chain.jl 87.09% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3cda9f3...4b20efe. Read the comment docs.

@chriselrod chriselrod merged commit 0965354 into main Jun 25, 2022
@chriselrod chriselrod deleted the fastertasklocalmem branch June 25, 2022 08:26
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