[ ] Fast path aborts when encounting a lightfunc because a lightfunc might inherit a .toJSON() method. It would be better to check for .toJSON() explicitly and continue in the fast path in the (very likely) case where no such method exists.
[ ] Fast path aborts on presence of `.toJSON() even when it's not callable. This is probably not worth fixing.
[ ] JX automatic unquoted key emitter first checks the key for being compatible and then emits the key as is or emits an ordinary string. This could be done in one pass: start emitting the unquoted key, and if an incompatible character is encountered, rewind the bufwriter and write the normally quoted key.
[ ] Slow path now uses a "enc1 + enc2" helper approach which could now be reworked to just emit in one step and backtrack if the value should actually have been dropped. Refactor in a separate pull.
[ ] Slow path loop detection could be made optimistic: try once with only a stack depth and output size limit. If limit reached, retry with loop detection. This does mean, however, that .toJSON() methods would be called multiple times which is in the strict sense non-compliant.
/* */
and//
style comments.