TeamSirenix / odin-serializer

Fast, robust, powerful and extendible .NET serializer built for Unity

Home Page:http://www.odininspector.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JsonTextReader performance suggestion - Use Ordinal string comparison instead of InvariantCulture

JPerryOddGames opened this issue · comments

Hi,

I was able to make some meaningful performance improvements in deserializing large json files by changing JsonTextReader.cs to use the Ordinal string comparer instead of using InvariantCulture.
As far as I am aware, this change should not break the code for any device with any culture since the code is already explicitly using InvariantCulture. Given the strings we are checking for are all simple hard-coded strings with English characters and a few symbols ($, {, }, [, ]) there should be no difference in the results of an Ordinal or InvariantCulture equality comparison.

Please advise if there is indeed a case where this could potentially break something

No, this is a good idea - I've approved your pull request. A little late, but approved nevertheless :)