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

Improve unicode codepoint Bisearch performance #691

Merged
merged 3 commits into from
Jun 27, 2023

Conversation

StefanRvO
Copy link
Contributor

Improve the performance of the functions for searching for codepoints in a table by passing the table array in as a reference instead of copying it.

This doesn't really improve the results of the benchmarks for some reason, but in my application with GCC8 i686, Intel Atom E3950 and a 180x60 terminal, this reduces the time for rendering a frame from ~31 ms to ~5.5 ms.

StefanRvO and others added 2 commits June 27, 2023 21:00
Improve the performance of the functions for searching for codepoints
in a table by passing the table array in as a reference instead of copying
it.

This doesn't really improve the results of the benchmarks for some reason,
but in my application with GCC8 i686, Intel Atom E3950 and a 180x60 terminal,
this reduces the time for rendering a frame from ~31 ms to ~5.5 ms.
@ArthurSonzogni
Copy link
Owner

Wow! I can't believe this got unnoticed for so long. Thank you!

I added a benchmark. I measured this improves debug performance by 3x and Release performance by 0x. I guess the compiler was able to optimize this function.

Copy link
Owner

@ArthurSonzogni ArthurSonzogni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ArthurSonzogni ArthurSonzogni merged commit b2f66c7 into ArthurSonzogni:main Jun 27, 2023
6 checks passed
@StefanRvO
Copy link
Contributor Author

StefanRvO commented Jun 27, 2023

Yeah, I'm guessing my older GCC8 for some reason isn't able to optimize it, but newer compilers probably are. I would guess that the compiler would see these as great in-lining candidates as it is only used inside the module, but at least GCC 8 with -O3 doesn't do that.

ArthurSonzogni added a commit that referenced this pull request Jul 25, 2023
Improve the performance of the functions for searching for codepoints
in a table by passing the table array in as a reference instead of copying
it.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
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