Mostly the property handling seems to be a bottleneck. For small JSON objects, we have only 1-2 properties, but the findElement in PropertyHashMap then becomes a bottleneck.
For larger objects, the general property handling also takes time. The various JSON function are also implemented "by spec" for compliance and could use optimization work. Parsing/lexing JSON also takes a lot of time. We should probably add JSON to the code cache or serialize JSON objects or something.
One (rather messy) way to do it, is to treat constant property map literals for JSON such as the FieldObjectCreator does -generate bytecode with putfields.
Hannes says: I think for property maps the key is to use spill - we can populate the object much easier, and accessors are cached already (Marcus comments: but all defineOwnProperty that JSON.parse does already create spill properties?)
Hannes also says: well we use the ScriptObject API. We should use some bulk methods to create properties and maps. (good idea)
Now with my concat fix checked in you can use
as a JSON benchmark. All it does is parse assorted JSON in various forms.