r/Compilers • u/BrainThinkerMan • 24d ago
Compilers add or remove perfomace?
isnt it that compilers change the code, as in not only transferring it into machine language, but before that changing the structure of the code. so how would one attempt to make performant code if the compiler changes sed code that i tried to make performant?
2
Upvotes
View all comments
Show parent comment
4
u/EpochVanquisher 24d ago
Yeah, I came in here to say the exact same thing.
To add to your comment, the different IRs will often have different “levels” of information, like the higher-level IR will have more type information, and the lower-level IR will have more information about stuff like exact values and memory layout. Different optimizations at different levels (but the AST usually isn’t optimized)