Skip to content

Conversation

@bdash
Copy link
Contributor

@bdash bdash commented Dec 9, 2025

This avoids constructing numerous unordered maps and vectors at library load time in every plug-in that uses the C++ API. Additionally, the arrays allow for more efficient look-ups.

@plafosse
Copy link
Member

In general I'm a huge fan of this PR. I appreciate all the static asserts which should help this code from breaking in the future. I don't see downsides to any of this. This seems like it should shave off some bytes on every IL instruction allocation which is a nice win too.

I was trying to see if anything could be made consteval to provide stronger guarantees of compile-time generation but I'm not sure about which parts could be converted or what the compiler support is for consteval.

@bdash
Copy link
Contributor Author

bdash commented Dec 10, 2025

In practice, what we care about is that the static variables are compile-time constants and not initialized at runtime. Being declared as static constexpr provides that guarantee. Adding consteval would be useful if what we care about is guaranteeing that a given function is only ever used at compile time. That's less important here since the functions are implementation details.

This avoids constructing two unordered maps and numerous vectors for
each IL level at library load time for each plug-in that uses the C++
API. Additionally, the arrays allow for more efficient look-ups.
@bdash bdash force-pushed the test_constexpr_il_operand_data branch from 7ba96c1 to 62ded0d Compare December 12, 2025 05:17
@bdash bdash force-pushed the test_enum_fixed_underlying_type branch from 8440e4f to 290bbcf Compare December 12, 2025 05:17
Base automatically changed from test_enum_fixed_underlying_type to dev December 12, 2025 05:30
@bdash bdash merged commit 62ded0d into dev Dec 12, 2025
5 checks passed
@bdash bdash deleted the test_constexpr_il_operand_data branch December 12, 2025 05:30
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.

3 participants