Someone in my company send out a FizzBuzz challenge last year. In proceeding to waste a good part of an afternoon, we found several good answers. We actually found that this method was one of the slower methods, even though by calculation it should be super fast. We concluded that this form of lookup table was going to memory every time which resulted in significant lag.
The winner implemented the lookup list as a switch statement. While very similar, it ran significantly faster. My guess is the switch statement was stored in a L cache.
It was all in JS so that will have some to do with the results.
View all comments
Show parent comment
1
u/[deleted] Jan 19 '14
Someone in my company send out a FizzBuzz challenge last year. In proceeding to waste a good part of an afternoon, we found several good answers. We actually found that this method was one of the slower methods, even though by calculation it should be super fast. We concluded that this form of lookup table was going to memory every time which resulted in significant lag.
The winner implemented the lookup list as a switch statement. While very similar, it ran significantly faster. My guess is the switch statement was stored in a L cache.
It was all in JS so that will have some to do with the results.