Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Just one well placed virtual function saves the day

Just one well placed virtual function saves the day

Scheduled Pinned Locked Moved The Lounge
performancejson
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #1

    I've been trying to speed up my JSON processing and the bottleneck was my I/O class. So I added a function to my I/O classes called skipToAny() which takes a string of characters and advances the input until it finds one of them. Depending on the kind of source you use (like memory mapped file sources) it's *fast* apparently strpbrk() is optimized for SSE and AVX instructions w/ some stdlib implementations. So using the builtin C function to scan over my memory mapped buffer increases my performance by a factor of almost 4. I'm in spitting distance of 600MB/s now. And I didn't even need to bit twiddle. Higher level optimizations > bit twiddling

    Real programmers use butterflies

    J 1 Reply Last reply
    0
    • H honey the codewitch

      I've been trying to speed up my JSON processing and the bottleneck was my I/O class. So I added a function to my I/O classes called skipToAny() which takes a string of characters and advances the input until it finds one of them. Depending on the kind of source you use (like memory mapped file sources) it's *fast* apparently strpbrk() is optimized for SSE and AVX instructions w/ some stdlib implementations. So using the builtin C function to scan over my memory mapped buffer increases my performance by a factor of almost 4. I'm in spitting distance of 600MB/s now. And I didn't even need to bit twiddle. Higher level optimizations > bit twiddling

      Real programmers use butterflies

      J Offline
      J Offline
      Josh Gray2
      wrote on last edited by
      #2

      This is a very specific topic but oddly I received an email from a colleague today about a library called simdjson which gives a significant performance improvement over other c++ json libraries. simdjson claim 'Standalone UTF8 Validation' at 13/GB/s

      H 1 Reply Last reply
      0
      • J Josh Gray2

        This is a very specific topic but oddly I received an email from a colleague today about a library called simdjson which gives a significant performance improvement over other c++ json libraries. simdjson claim 'Standalone UTF8 Validation' at 13/GB/s

        H Offline
        H Offline
        honey the codewitch
        wrote on last edited by
        #3

        simdjson is cool, but it doesn't run everywhere. My JSON thing will even run on arduinos

        Real programmers use butterflies

        D 1 Reply Last reply
        0
        • H honey the codewitch

          simdjson is cool, but it doesn't run everywhere. My JSON thing will even run on arduinos

          Real programmers use butterflies

          D Offline
          D Offline
          DRHuff
          wrote on last edited by
          #4

          What are you doing on an Arduino that needs to process large Json files so quickly? Or is this just a case of seeing how many people can fit in a phone booth?

          If you can't laugh at yourself - ask me and I will do it for you.

          H 1 Reply Last reply
          0
          • D DRHuff

            What are you doing on an Arduino that needs to process large Json files so quickly? Or is this just a case of seeing how many people can fit in a phone booth?

            If you can't laugh at yourself - ask me and I will do it for you.

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #5

            It's not fast on an 8 bit Arduino, it's just that it scales to workstations and servers. The advantage of it over ArduinoJSON is the same library also blazes on traditional computers, and it actually uses far less RAM than ArduinoJSON, which cannot process large online dumps from say, a mongoDB backed repository, like the one tbdb.com runs. ETA: Originally I wrote it to try out a novel way of parsing and running queries, but it turns out simdjson just recently invented something similar. =)

            Real programmers use butterflies

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups