Compile the extension with the engine's explicit Release flags - #23
Merged
Conversation
The _sparsediffengine target was only optimized because CMake's default CMAKE_C_FLAGS_RELEASE happens to be -O3 -DNDEBUG. Pin cmake.build-type to Release in pyproject.toml and give the extension the same per-config target_compile_options block the engine applies to dnlp_diff, so the optimization level no longer depends on toolchain defaults. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CUDtSX6BT4SiDzfPKVZF9C
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.
Make compilation flags and release mode explicit.
Claude below:
Summary
The
_sparsediffengineextension target was only optimized because CMake's defaultCMAKE_C_FLAGS_RELEASEhappens to be-O3 -DNDEBUG. The engine's own-O3 -DNDEBUG//O2 /DNDEBUGblock is scoped todnlp_diff, so the extension inherited nothing explicit.pyproject.toml: pincmake.build-type = "Release"(matches the scikit-build-core default; makes the intent declared rather than inherited).CMakeLists.txt: add the same four-configtarget_compile_optionsblock the engine uses, scopedPRIVATEto_sparsediffengine.Per-target options are emitted after
CMAKE_C_FLAGS, so the extension's-O3deliberately wins over a packager'sCFLAGS, the same policy the engine already applies to itself. Release builds already definedNDEBUG, so no behavior changes; the bindings contain noassertcalls of their own.