4 ms·
When you already know what you want to have after the optimization, you could just write that code in the beginning.
by randomNumber7 2y ago
When you already know what you want to have after the optimization, you could just write that code in the beginning.
- aleph_minus_one 2y agoNot all programming languages have this amount of expressiveness. How do you, for example, tell how a database what the intended execution plan is for some complicated SQL query? You can normally only send SQL queries to a database and not execution plans.
- Spivak 2y agoI've always wanted to just write the execution plan directly and bypass the planner for a few hot queries.
- magicalhippo 2y agoUsing bit rotation instructions in C is another case I recall. Since there's no bit rotate operator in C, you're left hoping the compiler recognizes what the shifts and bitwise-ands are trying to do.
- keybored 2y agoLet’s assume that you can rewrite it, e.g. write some inline assembly. The thinking here seems to be that you want multiple things: 1. You want the high-level code since that is easier to reason about 2. You also want some specific optimizations Maybe the missing link here is some annotation that asserts that some optimization is applied. Then if that assertion fails at some point you might have to bite the bullet and inline that assembly. Because (2) might trump (1).