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

Avoid allocations in ascii_lc_isequal #725

Merged
merged 1 commit into from Jun 20, 2021
Merged

Avoid allocations in ascii_lc_isequal #725

merged 1 commit into from Jun 20, 2021

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented Jun 18, 2021

Fixes #724. Maybe in a perfect world, the compiler would be able to "see
through" the calls to Iterators.Stateful and zip iterating through
them to avoid allocating Stateful at all, but this also just feels
like a case of a very low-level function trying to use high-level
constructs. The proposed code here is an order of magnitude faster (~10x
in the few cases I tested), avoids all allocations, and IMO, is simpler
(I'm guessing most users don't immediately understand what
Iterators.Stateful is for).

Fixes #724. Maybe in a perfect world, the compiler would be able to "see
through" the calls to `Iterators.Stateful` and `zip` iterating through
them to avoid allocating `Stateful` at all, but this also just feels
like a case of a very low-level function trying to use high-level
constructs. The proposed code here is an order of magnitude faster (~10x
in the few cases I tested), avoids all allocations, and IMO, is simpler
(I'm guessing most users don't immediately understand what
`Iterators.Stateful` is for).
@codecov-commenter
Copy link

codecov-commenter commented Jun 18, 2021

Codecov Report

Merging #725 (9692998) into master (ffee0a0) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #725      +/-   ##
==========================================
+ Coverage   76.82%   76.87%   +0.05%     
==========================================
  Files          37       37              
  Lines        2442     2443       +1     
==========================================
+ Hits         1876     1878       +2     
+ Misses        566      565       -1     
Impacted Files Coverage Δ
src/ascii.jl 100.00% <100.00%> (ø)
src/IOExtras.jl 81.25% <0.00%> (+3.12%) ⬆️

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 ffee0a0...9692998. Read the comment docs.

@quinnj quinnj merged commit 6e0a60b into master Jun 20, 2021
@quinnj quinnj deleted the jq/asciiperf branch June 20, 2021 05:22
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.

Possibly excessive memory allocations in ascii.jl
2 participants