Skip to content

Docs: the rc ray tracer difference under stack promotion is heap layout - #608

Merged
ASDAlexander77 merged 1 commit into
mainfrom
docs-raytracer-heap-layout
Oct 18, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
docs-raytracer-heap-layout

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

#605 documented the ray tracer as about 8% slower under `-mm=rc` with stack promotion, and called the cause not understood. It is heap layout. The two promoted objects were the program's first heap allocations, so without them every later object lands elsewhere. Put two throwaway heap allocations of the same size back at the same point and the promoted build runs at the unpromoted speed:

build median ms
promoted 168
`--no-stack-promotion` 158
promoted + 2 throwaway allocations 157
unpromoted + 2 throwaway allocations 158

The hot functions' IR is identical in every build. Docs only.

🤖 Generated with Claude Code

Two throwaway heap allocations at the point of the two promoted objects
bring the promoted build back to the unpromoted time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit e4065eb into main Oct 18, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the docs-raytracer-heap-layout branch October 18, 2026 20:15
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.

1 participant