[RFC] Break down the static library into multiple files#300
Open
Algunenano wants to merge 1 commit intoashvardanian:mainfrom
Open
[RFC] Break down the static library into multiple files#300Algunenano wants to merge 1 commit intoashvardanian:mainfrom
Algunenano wants to merge 1 commit intoashvardanian:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After updating ClickHouse to 4.6.0 we've noticed that
stringzilla.chas become a bottleneck in the build, as it takes from ~90 (release) to ~150 (asan) seconds to build. The problem is that it build all the functions in a single translation unit, and compiling and specially optimizing it takes quite a bit of time.Instead we could separate the functions into different files and build them independently and in parallel. Doing it this way reduces the build time to the slowest file (
utf8_case.c, around 3 seconds with ASAN):To implement this each file includes a single header and redefines the macros to expose the symbols in the translation unit (built
SZ_DYNAMIC_DISPATCH=0) and in the headers we hide the implementation when building withSZ_DYNAMIC_DISPATCH=1, sostringzilla.conly sees the function definitions.I had to fight with the LLM to get it to do what I needed, so for transparency here is its summary.
Note that I've only tested this with Linux and clang so far. It's likely that other platforms would need a different approach.