Comments (6)
Hmm.. How "deep" is the object in question? It looks it's doing a lot of nested calls. This might just be one of those situations where abstraction hurts you, since 100K of JSON is actually a fair amount of data, especially if it's highly structured (rather than, say, a big array of values).
I haven't done anything with IL2CPP thus far. Any of my iOS work was in the Pre-IL2CPP days. Let me do some tests when I have the chance (probably not today, sorry), but I'll get back to you when I do. Please feel free to post to the Unity forums and/or try a couple of other JSON packages. If any of the other managed implementations (most of what you'll find for C# JSON), see if you can find a way to wrap a C++/C implementation as a plugin, which will hopefully not get touched by IL2CPP, being that it's not IL :)
from jsonobject.
The object is not too deep. It contains around 10-20 keys / lists with some structure and a big string value (which accounts for most of the 100K). I will try some of the approaches you suggest.
from jsonobject.
Hm. If the majority of the data is a single string, that kind of throws out my theory. As long as it recognizes it as a string, the parser should just skip over that entire chunk of data. Are you sure there aren't any unescaped quotes. Do you think you could pastebin or otherwise send me the source data for testing? I haven't had a chance to try it yet but I think I can do so today.
from jsonobject.
Hey there,
I can confirm that IL2CPP performance is pretty terrible. I noticed that calls to Array.IndexOf seemed to be at the top of the list, and they're coming from the fact that I use an array to list the whitespace characters which are passed over by the parser. Switching this to a series of if statements seems to improve performance greatly. I used to do a string.Replace on all the whitespace, but some users didn't like the fact that that would remove whitespace from your data. It also might end up being slow.
I didn't make any scientific comparison, but I hope this fix does the job for you. Otherwise, I'm not sure that I can do much in C#. I've already tried to optimize the parser as much as I can, so without a better algorithm (is there one?), we'll just have to wait until Unity improves their IL2CPP implementation or we come up with a native plugin to do the parsing. I've actually been thinking about adding support for Binary JSON, which is sort of unrelated, but is a big enough refactor that I'm considering also doing that C/C++ plugin thing. I'll let you know how it goes, but don't expect progress anytime soon.
I'm going to close this issue, but please feel free to re-open it if you need more help.
from jsonobject.
Oh yeah, I came across this tool, which was really useful for testing "big JSON"
http://beta.json-generator.com/LJoZd1T
This is the big JSON I was testing with:
http://beta.json-generator.com/api/json/get/J-uOMMr
from jsonobject.
By the way, 5.1.1p4 makes a note about performance improvements to IL2CPP boxing/unboxing. You might want to check it out.
Furthermore, I would submit a bug to Unity with your project folder to show them what's going wrong. It may be some weird edge case that it's bringing up which will help them improve their IL2CPP toolchain for everyone.
from jsonobject.
Related Issues (20)
- Include newer Unity Versions HOT 1
- Unhandled Exception when used in UWP application HOT 1
- Error parsing float (when Globalization is set to german) HOT 3
- Lack of InvariantCulture in Stringify function HOT 1
- Cannot implicitly convert type `void' to `bool'
- Warning for obsolete code HOT 6
- [proposal] (Unit-)Tests HOT 1
- I think you are missing a case for Deep string value, please loot at this example HOT 2
- [solution] for #POOLING "wtf/wtflist" problem HOT 2
- [Localization] Serializing JSONObject yields the incorrect result in different cultural regions HOT 1
- Use double precision as default (or better: support double in addition) HOT 5
- Wrong conversion depending on CulturalInfo HOT 3
- Unescaped characters when downloading from certain servers HOT 1
- JsonSerializationException: Self referencing loop detected for property 'normalized' with type 'UnityEngine.Vector3'. Path '[0].fill.bounds.center.normalized.normalized'. HOT 2
- Creates Type.Object where list.Count and keys.Count are out of sync HOT 1
- JSON Checker is potentially misleading HOT 3
- parse from {} or [] throws ArgumentException "Cannot parse if offset is greater than or equal to end offset" HOT 1
- Question: Supported Platforms.
- problem support null
- Can't Parse Array Json proper
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonobject.