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

fix: parser performance issues #307

Merged
merged 1 commit into from
Feb 5, 2021

Conversation

baszalmstra
Copy link
Collaborator

I found a loop that iterates over a lot of elements that accidentally loops O(n) times where it should be O(n). This caused huge performance issues that this MR fixes.

The change looks more complicated than it actually is. What was happening was this:

for _i in 0..events.len() {
        for i in 0..events.len() {
                       // Stuff
        }
}

where it should be:

        for i in 0..events.len() {
                       // Stuff
        }

This caused completions in a large file that I'm using to go from 300ms to 3ms but it affected all operations.

@baszalmstra baszalmstra added the type: fix Bug fix or report label Feb 4, 2021
@baszalmstra baszalmstra self-assigned this Feb 4, 2021
@codecov
Copy link

codecov bot commented Feb 4, 2021

Codecov Report

Merging #307 (0c3e591) into master (9c7e847) will decrease coverage by 0.00%.
The diff coverage is 95.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #307      +/-   ##
==========================================
- Coverage   81.42%   81.41%   -0.01%     
==========================================
  Files         239      239              
  Lines       14026    14025       -1     
==========================================
- Hits        11420    11419       -1     
  Misses       2606     2606              
Impacted Files Coverage Δ
crates/mun_syntax/src/parsing/event.rs 96.29% <95.83%> (-0.14%) ⬇️

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 9c7e847...0c3e591. Read the comment docs.

@baszalmstra baszalmstra merged commit c0185b7 into mun-lang:master Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: fix Bug fix or report
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants