4 ms·
What's really remarkable about this as everyone argues whether it's good for a "software engineer" to have even the most basic understanding of how a computer w
by ben7799 5y ago
What's really remarkable about this as everyone argues whether it's good for a "software engineer" to have even the most basic understanding of how a computer works is the magnitude of extra work being done here as the computer sees it versus what the coder sees.
The coder sees one version being one line with an operator they don't know and the other version being 10 lines of code that look a little dense but it's all stuff they know.
The computer sees one instruction versus thousands or maybe tens of thousands.
Now is it silly to check if a multiplication is by 2 and then use shifts if you're writing a high level language and it's a one off/non-critical operation? Yes it is. But if you're decoding/encoding binary data as a lot of people have conjectured then you're probably doing a lot of it and this really matters.