-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
I absolutely love the elegance and reusability of the switchObj pattern (even if it’s slower), but I’d like to get this straight.
See http://twatlr.com/thread/140407213511544833
Here’s @felixge’s test case: http://jsperf.com/object-vs-regular-switch
For my Velocity preso I created this test: http://jsperf.com/switch-vs-object-literal-vs-module/2 But it seemed regular switch was still faster. Any idea what’s up with that?
Rick’s test case only seems to test for the case where foo is a defined key in the switchObj, and doesn’t have the hasOwnProperty check. Perhaps that’s what caused the confusion?