Closed joar closed 8 years ago
hi, thanks for your patch!
just some observations, did you changed to ifs only to use bitmasks? why not just introduce another constant for special objects and keep the switch?
I'm using this lib in a performance sensitive place (hundreds of potentially big objects) and when I update this lib, if my benchmarks show that the if is slower I will revert back to a switch statement.
just want to know if there's a performance reason that I don't know of (I would expect switch to be optimized to a jump table but the "if" solution not, but maybe there's an optimization I'm not aware of)
I chose if..else-if..else because it was more sraight-forward when dealing with bitmasks.
I've put together a perf test which compares the isolated bitmask-in-switch and bitmask-in-if behaviour and the difference is minimal.
ok, thanks for the perf test and the patch!
Add support for Date objects and "empty objects" that are not objects. Uses obj.toString() to display the object.
Also convert "CONSTANTS" to be bitmask-compatible and replace
switch
statement withif
statement in order to be able to use bitmasks.