News for hackers. Stuff that matters.
Re:Using Dispatch Tables to Avoid Conditionals in JavaScript by drgath on Monday May 13, 2013 @10:45AM (#5698936)
> The performance is substantially different. The dispatch table is ~75% slower (in chrome).

Of course those are, they're doing very different things in that test case. Your first case is just returning a value, and the second is executing a function to return a value. Here's a better comparison, http://jsperf.com/switchvsdispatchtable/2

There's nothing inherently slow about dispatch tables, it all about how you implement them. As someone else mentioned, the OP should be using bind to reduce the # of function calls instead of executing a function which executes a function.

There are no comments on this comment yet.