Skip to content

use C++23 #embed to speed up compile - #1250

Closed
roj234 wants to merge 2 commits into
leejet:masterfrom
roj234:cpp23-embed-speedup
Closed

use C++23 #embed to speed up compile#1250
roj234 wants to merge 2 commits into
leejet:masterfrom
roj234:cpp23-embed-speedup

Conversation

@roj234

@roj234 roj234 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Also easier to edit and keep git log small
Only tested on LLVM-MinGW
Require some refactor to action script

(cherry picked from commit be84a3d)

@roj234

roj234 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

Current unable to compile on GitHub Actions...

@leejet

leejet commented Feb 4, 2026

Copy link
Copy Markdown
Owner

This would introduce a dependency on Python. One of the reasons I converted merges/vocab into an .hpp file in advance was precisely to avoid bringing in extra dependencies.

@roj234

roj234 commented Feb 4, 2026

Copy link
Copy Markdown
Contributor Author

Python is not necessary when compile using C++23, they are only used to re-create those hpps for compilers not support #embed yet (as as fallback), and GitHub Actions have Python installed.
If you don't like to remove those hpps, they can be included via macros.
On my computer, use #embed can save 15 seconds (about 1/3 time when I link to a pre-compiled GGML library). I feel the speedup and a cleaner git history are quite beneficial.
I'm not an expert on CMake and GitHub Actions, so I'm currently struggling with compiler arguments and CI failure.
To finish this PR, I may need to change CMake config and tune some compiler arguments... (However I have never used MSVC)

Only tested on LLVM-MinGW
@roj234
roj234 force-pushed the cpp23-embed-speedup branch 2 times, most recently from 13af3e1 to 474ba43 Compare February 21, 2026 15:44
@roj234
roj234 force-pushed the cpp23-embed-speedup branch from 474ba43 to 0fd5bb5 Compare February 21, 2026 15:48
@roj234
roj234 marked this pull request as ready for review February 21, 2026 15:52
@roj234

roj234 commented Feb 21, 2026

Copy link
Copy Markdown
Contributor Author

It can compile now, however no speedup at all, only a Python polyfill convert #embed to .h at runtime, some tweak on compiler options may be required.

@leejet

leejet commented May 16, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR. I’ll close this for now since it adds build/CI complexity without a clear measurable benefit. We can revisit once #embed is widely supported and dependency-free.

@leejet leejet closed this May 16, 2026
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