Repository navigation
Use set lookup for reserved shader identifiers - #3107
Merged
jstone-lucasfilm merged 1 commit intoOct 8, 2026
Merged
jstone-lucasfilm merged 1 commit into
jstone-lucasfilm merged 1 commit into
Conversation
jstone-lucasfilm
approved these changes
Oct 8, 2026
jstone-lucasfilm
left a comment
Member
There was a problem hiding this comment.
Thanks for this improvement, @tdavidovicNV!
jstone-lucasfilm
merged commit Oct 8, 2026
310e1d4
into
AcademySoftwareFoundation:main
73 checks passed
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.
While profiling shader generation, I noticed that
Syntax::makeValidNamesearches_reservedWordswithstd::find, even though the container is astd::set<string>.This switches to the set's
findmember, making the lookup logarithmic instead of linear. The membership check and generated identifiers are unchanged.I measured this change alone with the existing shader-generation tests over
Materials/TestSuiteandMaterials/Examples. Each active configuration traverses 195 documents; the full run makes 6,868 generation calls across GLSL, GLSL with layouts, Vulkan/WGSL, Slang, OSL, MDL and MSL. There is no rendering or downstream shader compilation, and the suite's normal exclusions and per-document implementation-cache clearing are unchanged.On my Core Ultra 9 285K (Windows, MSVC 19.38, x64 Release
/O2), the complete test run took 1.3% less time, measured as the median of eight paired reductions. That includes loading, document validation, code generation, assertions and normal test logging. Baseline/candidate order alternated, with both processes pinned to the same performance core after a full warmup each. All eight pairs improved, ranging from 0.1% to 7.5%; the initial unpinned measurements were too noisy to draw a conclusion. Separately timing just generation and source collection gave a 1.7% median paired reduction across all eight configurations. All 12,016 generated shader-stage sources were byte-identical, and the selected generation tests passed.Assisted-by: OpenAI Codex
I used Codex to help with the implementation, profiling/benchmarks and this description.