Giter Club home page Giter Club logo

Comments (6)

mtschoen avatar mtschoen commented on August 27, 2024

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.

martinell avatar martinell commented on August 27, 2024

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.

mtschoen avatar mtschoen commented on August 27, 2024

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.

mtschoen avatar mtschoen commented on August 27, 2024

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.

mtschoen avatar mtschoen commented on August 27, 2024

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.

mtschoen avatar mtschoen commented on August 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.