Skip to main content
3 events
when toggle format what by license comment
Apr 7, 2015 at 19:41 comment added rolfl That is a keen observation, @SimonAndréForsberg. You're probably mistaken on a couple of things though (as well as me). As I look at it, I can't actually say for sure that the lookup table is faster. We're talking about 256 or so bytes in memory that will be cached very close to the core (L1 cache), but, 4 if/else statements may be faster than 1 L1 lookup. It's a margin call. I would guess that all the systems (if/else, 4-value table, and all-value table) will be about as fast as each other in this situation.... Code Readability is probably the important thing, and I am not sure mine is best.
Apr 7, 2015 at 18:56 comment added Simon Forsberg Is there really a need for a lookup table if you have the age bounds array? Sure it will be faster, but is the additional memory worth it? Won't it be fast enough to loop through the age bounds array and determine the group from that?
Apr 7, 2015 at 18:41 history answered rolfl CC BY-SA 3.0