CouchDB
  1. CouchDB
  2. COUCHDB-747

use lists:keysearch BIF to traverse ejson

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.11
    • Fix Version/s: 1.1
    • Component/s: Database Core
    • Labels:
      None

      Description

      We use proplists:get_value to inspect JSON Objects in Erlang. I think we should switch to lists:keysearch. It's a BIF and appears to be 2-3x faster than proplists for a wide class of lookups. Here's a microbenchmark:

      http://gist.github.com/374220

      The get_value() functions in that gist provide a wrapper around keysearch to give it the same interface as proplists:get_value. The only incompatibility in the wrapper is that proplists will find atoms (instead of tuples) in the list, while keysearch will ignore them. But our JSON term format doesn't contain any standalone atoms, so this is not an issue for us.

        Activity

        Adam Kocoloski created issue -
        Adam Kocoloski made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Adam Kocoloski
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development