Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> On their own, % and / are way slower than +, -, *, <<, >>.

And the branch instruction is free??



More or less, assuming you can predict it. But there's a penalty for misprediction. So it boils down to whether using % frequently (either as a native instruction or as a sequence of instructions) is more or less expensive than predicting a branch frequently, given a certain misprediction rate.


> More or less, assuming you can predict it. But there's a penalty for misprediction.

Yeah, no, that's not free.


Ok, so what changes would you make to my explanations?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: