Giter Club home page Giter Club logo

Comments (3)

endocrimes avatar endocrimes commented on August 27, 2024 1

@vzsg Thanks for doing that! - I'll try and make some time for profiling this soon.

from jay.

czechboy0 avatar czechboy0 commented on August 27, 2024

There are performance tests in the test suite, so you could try to run those on the other parsers and compare? Let me know if you do! (I'm curious as well)

from jay.

vzsg avatar vzsg commented on August 27, 2024

I had some free time (and some insomnia), so I played around Jay and two readily available alternatives: JSONSerialization and PerfectLib. OP's other libraries are pure C with very different semantics, for which I lack both the patience and the experience to wrap for Swift.

Using sample data from here, and the benchmark classes from here, I hacked together a benchmark that loops through the parsers and the input files, parses the data 200 times, and measures the time taken by the actual JSON parsing.

Environment:

  • 2015 MBP (Core i5 2.7GHz, 8 GB RAM, power adapter)
  • macOS 10.12.3 Beta (16D12b)
  • Swift 3.0.2 (built in release mode, default optimization settings)

Results:

Source file (size) Library Average time RSD
actionLabel.json (872) JSONSerialization 0.088701ms 35.2%
Jay 0.27735ms 42.6%
PerfectLib 0.192724ms 56.7%
citm_catalog.json (1727204) JSONSerialization 10.5ms 13.0%
Jay 195.0ms 1.7%
PerfectLib 134.4ms 1.9%
medium.json (2202) JSONSerialization 0.110465ms 26.9%
Jay 0.516045ms 32.2%
PerfectLib 0.382738ms 37.7%
menu.json (276) JSONSerialization 0.082635ms 119.9%
Jay 0.109255ms 24.4%
PerfectLib 0.086137ms 107.8%
sgml.json (705) JSONSerialization 0.078692ms 30.1%
Jay 0.178616ms 25.3%
PerfectLib 0.135693ms 90.1%
small.json (42) JSONSerialization 0.077599ms 29.9%
Jay 0.050222ms 25.5%
PerfectLib 0.0388ms 30.7%
webxml.json (4054) JSONSerialization 0.145353ms 26.1%
Jay 1.006042ms 33.1%
PerfectLib 0.755938ms 34.0%
widget.json (761) JSONSerialization 0.114966ms 40.3%
Jay 0.279561ms 24.0%
PerfectLib 0.189957ms 25.9%

Takeaway:

There seems to be something very weird going on while parsing citm_catalog.json (~1,7 MBs) with both Swift libraries. That slow down is huge.

from jay.

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.