Re:I 10x'd a TI-84 emulator's speed by replacing a switch-case
by shultays on Monday August 08, 2022 @04:40AM
(#32383460)
But in js you can have maps of arbitrary types as keys right? So jump table could just use that
[ Parent
| on HN ]
Re:I 10x'd a TI-84 emulator's speed by replacing a switch-case
by mattashii on Monday August 08, 2022 @05:01AM
(#32383559)
that's not quite true, because arbitrary expressions can change meaning due to e.g. overloading of functions.
E.g. Random.random() will have to be called each time that case branch is evaluated, because that function could be overloaded or change its returned value.