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

lregex: optimize substitute() #3728

Merged

Conversation

masatake
Copy link
Member

substitute was one of the bottle neck.
It called strlen before memcpy.
We can remove the strlen invocation safely.

The original code:
$ xargs cat < /tmp/list > /dev/null; time ./ctags -L - < /tmp/list
./ctags -L - < /tmp/list 97.39s user 4.72s system 97% cpu 1:45.09 total

With this change:
$ xargs cat < /tmp/list > /dev/null; time ./ctags -L - < /tmp/list
./ctags -L - < /tmp/list 87.24s user 4.68s system 97% cpu 1:34.28 total

About 10% faster!

substitute was one of the bottle neck.
It called strlen before memcpy.
We can remove the strlen invocation safely.

The original code:
  $ xargs cat <  /tmp/list > /dev/null; time ./ctags -L - < /tmp/list
  ./ctags -L - < /tmp/list  97.39s user 4.72s system 97% cpu 1:45.09 total

With this change:
  $ xargs cat <  /tmp/list > /dev/null; time ./ctags -L - < /tmp/list
  ./ctags -L - < /tmp/list  87.24s user 4.68s system 97% cpu 1:34.28 total

About 10% faster!

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@codecov
Copy link

codecov bot commented May 18, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (ee10ac3) 82.99% compared to head (a04ac8f) 82.99%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3728   +/-   ##
=======================================
  Coverage   82.99%   82.99%           
=======================================
  Files         226      226           
  Lines       55006    55009    +3     
=======================================
+ Hits        45652    45655    +3     
  Misses       9354     9354           
Impacted Files Coverage Δ
main/lregex.c 82.87% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@masatake masatake merged commit bf1ba55 into universal-ctags:master May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant