GithubHelp home page GithubHelp logo

iossimdjson's Introduction

iossimdjson

Experimenting with JSON decoding on ios

Requirements

  • A recent mac with Xcode installed
  • A recent iOS device

Usage

  • Open simdjson.xcodeproj in Xcode (macOS)
  • Click on the "simdjson" project within Xcode, go to "Identity" and select a valid account under "Team".
  • Plug your device (e.g., iPhone) in your mac.
  • In Xcode, go to Window > Devices. This will open a new window. You should see your device in this new window. Don't lose this new window.
  • In Xcode, go to Product > Destination and choose your device. Note that a simulator won't do.
  • In Xcode, go to Product > Build For > Running.
  • You should see in Xcode under Products "simdjson.app", drag and drop it into the "Devices" window we opened previously.
  • You should now see the app on your device. By default, iOS won't let you run it, so go under Settings > General. You will find a setting there to allow you to run the app.
  • Run the app.

Sample result

iPhone XR, Xcode 10.1

 gsoc-2018.json 
speed of 1.625 GB/s 
speed of 1.702 GB/s 
speed of 1.747 GB/s 
Processor: 2.496610 GHz 

 twitter.json 
speed of 1.209 GB/s 
speed of 1.285 GB/s 
speed of 1.297 GB/s 
Processor: 2.496610 GHz 

 github_events.json 
speed of 0.984 GB/s 
speed of 1.163 GB/s 
speed of 1.212 GB/s 
Processor: 2.496610 GHz 

 update-center.json 
speed of 1.030 GB/s 
speed of 1.063 GB/s 
speed of 1.101 GB/s 
Processor: 2.496610 GHz 

For comparison, let us multiply all these numbers by 3.7/2.5 to 'scale them' to a desktop processor. We get speeds of 2.5 GB/s, 1.9 GB/s, 1.8 GB/s, 1.6 GB/s. Here are the numbers we get on a skylake processor running at 3.7 GHz: 3.2 GB/s, 2.2 GB/s, 2.4 GB/s, 1.9 GB/s. That's unfair, however, because the skylake processor benefits from 256-bit registers (AVX). Let us 'downgrade' the skylake processor by disabling AVX instructions, we then get speeds of 1.9 GB/s, 1.4 GB/s, 1.6 GB/s, 1.3 GB/s. So with a corrected clock, we find that Apple's A12 processor is somewhere between a skylake processor with AVX disabled and a full skylake processor, with the caveat that we have to 'scale' the frequency of the iPhone processor artificially.

CocoaPods

There is a CocoaPods version: https://github.com/ppamorim/simdjson-cocoa

Credit

The app. reuses code by Benoît Maison.

iossimdjson's People

Contributors

lemire avatar

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.