Repository navigation
|
Reasonably, the header should be a lot smaller, since it doesn't contain the implementation, but it's instead a lot larger. Why is this? |
Replies: 2 comments
|
Three overlapping reasons:
The actual ratio in the current amalgamation is ~2.8× ( If header size is a real problem for your build:
|
|
@gistrec Gave a great answer. For a better build experience, you can use precompiled headers. |
Three overlapping reasons:
Templated kernels live in headers. simdjson does runtime CPU dispatch across multiple SIMD kernels - there are 9 of them right now (
westmere,haswell,icelake,arm64,ppc64,lasx,lsx,rvv-vls,fallback; seesrc/*.cppandinclude/simdjson/<kernel>/)The On-Demand API is template-heavy, and templates have to be visible in every translation unit that instantiates them - so the per-kernel template definitions get amalgamated into
simdjson.hwhile the.cpponly contains non-template wiringHeader-only mode is supported. Define
SIMDJSON_HEADER_ONLYbefore including, and the entire library compiles inline from the header - which meanssimdjson.hhas to contain ev…