3 ms·
They are highly correlated. The best way to achieve constant time is making your code paths data independent, that is, it always execute the same instructions,
by marcosdumay 11y ago
They are highly correlated.
The best way to achieve constant time is making your code paths data independent, that is, it always execute the same instructions, whatever the data. This code will also use constant power and have constant EM emission. (Except for low level optimizations in hardware, that may break any of those characteristics.)
- mikeash 11y agoThat parenthetical sounds extremely important! Won't executing the same instructions on different data use different amounts of power and emit different amounts of EM? For example, I would think (naively, I'm only familiar with the most basic of hardware whatnot) that multiplying 0 and 0 would not use the same amount of power and emit the same EM as multiplying 0xffffffff by 0xffffffff.
- powerbutton65 11y agoYes, this exactly the basis of differential power analysis. This was first demonstrated back in 1999 by Kocher et al [0] [0]: https://www.cis.upenn.edu/~nadiah/courses/cis800-02-f13/readings/kocher-jaffe-jun.pdf https://www.cis.upenn.edu/~nadiah/courses/cis800-02-f13/read...
- baby 11y agoand in a video: https://www.youtube.com/watch?v=gbqNCgVcXsM https://www.youtube.com/watch?v=gbqNCgVcXsM
- deleted 11y ago[deleted]
- marcosdumay 11y agoThat depends on the specifics. The fastest implementation of most integer instructions use constant time. Constant power and EM depend on some extra factors, but when there is variance, it is normally very small (a transistor or two not switching for each bit of difference).