Closed wahfl2 closed 4 months ago
Given that SHsuperCM seems to be on a hiatus, i've created a temporary patch fork with a release file under https://github.com/wchristian/CITResewnJSONLagPatch which will be available on Modrinth and Curseforge once moderation has approved them.
Thanks for the research and the patch, wahfl2. :)
And it's available on modrinth and curseforge now:
https://modrinth.com/mod/cit-resewn-jsonlagpatch https://legacy.curseforge.com/minecraft/mc-mods/cit-resewn-jsonlagpatch
i just pushed out v1.1.3.1 of cit-resewn-jsonlagpatch to modrinth and curseforge with #343, which contains an additional performance improvement originally made by @nea89o, with slight adjustments for earlier feedback from SHsuperCM in #315
https://modrinth.com/mod/cit-resewn-jsonlagpatch/versions https://legacy.curseforge.com/minecraft/mc-mods/cit-resewn-jsonlagpatch/files
So a few things,
fromJson
and fromLenientJson
perform roughly the same, the difference between them is negligible and it is to do with the path they take to get to gson's JsonReader
.JsonParser.parseString
(which is what fromJson
uses) it still goes through parseReader
which forces lenient reading. The only difference being that when using parseString
it wraps certain exceptions in JsonExceptions.test
is to return true or false, the caller should not be concerned if there is a "malformed" json in there or not, tests yield true or false.I am closing this PR and again, I have good reason to do so.
As my last PR was closed after a review instead of giving me time to implement the requested changes, I'm opening another one. This still gives roughly the same performance boost as #311; see that for screenshots.
This PR implements a much less intrusive optimization, adding only 7 characters to 1 line of code. It should not change the behavior of CITResewn in any way, shape, or form.
The second commit might be slightly more "controversial" since I didn't do extensive testing to see if it would/could throw any other exception. The owner may choose not to include this commit.