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

Optimize grep search performance #1071

Merged
merged 6 commits into from
Apr 18, 2024
Merged

Optimize grep search performance #1071

merged 6 commits into from
Apr 18, 2024

Conversation

liuchengxu
Copy link
Owner

The key change is to avoid the unnecessary function call in the busy loop. Hyperfine indicates the performance is increased by 20+%.

hyperfine './maple-master grep --ripgrep --cmd-dir /home/xlc/Data2/github.com/paritytech/polkadot-sdk/ client' './maple grep --lib-ripgrep --cmd-dir /home/xlc/Data2/github.com/paritytech/polkadot-sdk/ client'
Benchmark 1: ./maple-master grep --ripgrep --cmd-dir /home/xlc/Data2/github.com/paritytech/polkadot-sdk/ client
  Time (mean ± σ):     640.4 ms ±  23.7 ms    [User: 1226.0 ms, System: 448.3 ms]
  Range (min … max):   579.1 ms … 664.8 ms    10 runs
 
Benchmark 2: ./maple grep --lib-ripgrep --cmd-dir /home/xlc/Data2/github.com/paritytech/polkadot-sdk/ client
  Time (mean ± σ):     514.5 ms ±  19.7 ms    [User: 1002.1 ms, System: 355.3 ms]
  Range (min … max):   467.0 ms … 531.7 ms    10 runs
 
Summary
  ./maple grep --lib-ripgrep --cmd-dir /home/xlc/Data2/github.com/paritytech/polkadot-sdk/ client ran
    1.24 ± 0.07 times faster than ./maple-master grep --ripgrep --cmd-dir /home/xlc/Data2/github.com/paritytech/polkadot-sdk/ client

@liuchengxu liuchengxu merged commit 484c9a9 into master Apr 18, 2024
17 checks passed
@liuchengxu liuchengxu deleted the markdown-preview branch April 18, 2024 09:32
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