First off, kudos to the team for the recent json stringify optimizations! While looking at the new (and old) code I noticed that the way <https://github.com/v8/v8/blob/main/src/json/json-stringifier.cc#L2454>the escaped size of a string is being estimated uses an optimization which could introduce large memory overhead. I don't think that optimizing away a multiplication is worth the memory trade off especially when dealing with serialization of large strings.
I would recommend that the function uses the proper max estimation of 6x the string length size_t MaxEscapedStringLength(size_t length) { return length * 6; } -- Ledion Bitincka Co-founder | CTO cribl.io | <https://www.cribl.io>@ledbit <https://twitter.com/ledbit> Curious about our products? <https://sandbox.cribl.io/> -- -- v8-dev mailing list v8-dev@googlegroups.com http://groups.google.com/group/v8-dev --- You received this message because you are subscribed to the Google Groups "v8-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/v8-dev/CALYig4gO4VADgFKfDyhtgWE7VJe0_UW20eFzOwUq-wvkFRqSTQ%40mail.gmail.com.