You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For comparison, Context.parse of the same string is about 100x faster.
The reason seems to be that Reflect.setField (called from haxe.format.JsonParser::parseRec) is sloooooow. This can be quickly verified by nooping it out: https://try.haxe.org/#2F9517aC
The text was updated successfully, but these errors were encountered:
back2dos
added a commit
to back2dos/cix
that referenced
this issue
Jun 2, 2021
The problem is that the object prototype is updated on each setField, and that's not a very fast operation.
I guess for cases like this we really need a proper dictionary mode for objects. This is going to require some engineering, but should be worth the effort.
I've made a change to put objects in dictionary mode when there's a write-access to an unknown field. This should greatly help dynamic code while not hurt properly typed code much either (it's just one additional branch which I doubt can be measured).
Will keep this issue open so I remember to check the benchmarks because there could be some negative side-effect I'm overlooking.
Here's an example: https://try.haxe.org/#e820468b
The full data was taken from https://github.com/benmerckx/mime/blob/master/src/mime-db.json (170KB), but on try.haxe that makes the compiler run out of memory (takes about 2s to parse and allocates ~300MB).
For comparison,
Context.parse
of the same string is about 100x faster.The reason seems to be that
Reflect.setField
(called fromhaxe.format.JsonParser::parseRec
) is sloooooow. This can be quickly verified by nooping it out: https://try.haxe.org/#2F9517aCThe text was updated successfully, but these errors were encountered: