Coder Social home page Coder Social logo

i-json's People

Contributors

alfred-nsh avatar bjouhier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

i-json's Issues

build error

> node-gyp rebuild

make: Entering directory `/tmp/i-json/build'
  CXX(target) Release/obj.target/ijson_bindings/src/parser.o
../src/parser.cc: In member function ‘void ijson::Cache::intern(ijson::Parser*, char*, size_t, v8::Local<v8::Value>*, ijson::Cache*, uint64_t)’:
../src/parser.cc:95:66: error: ‘memcmp’ was not declared in this scope
     if ((size_t)entry->len == len && !memcmp(p, entry->bytes, len)) {
                                                                  ^
../src/parser.cc:102:32: error: ‘memcpy’ was not declared in this scope
     memcpy(entry->bytes, p, len);
                                ^
../src/parser.cc: In function ‘int ijson::makeClass(const char*)’:
../src/parser.cc:204:37: error: ‘strlen’ was not declared in this scope
     for (int i = 0, len = strlen(str); i < len; i++) {
                                     ^
make: *** [Release/obj.target/ijson_bindings/src/parser.o] Error 1
make: Leaving directory `/tmp/i-json/build'
gyp ERR! build error 
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! node -v v0.10.30
gyp ERR! node-gyp -v v0.13.1
$ uname -a
Linux manta 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/issue
Ubuntu 14.04.1 LTS \n \l

Two different files, two different parse errors.

I was trying out this module and got two json files that can not be parsed.

The first npm.json, taken from https://github.com/dscape/clarinet/blob/master/samples/npm.json fails with

/Users/dignifiedquire/work/codio/experiments/json/node_modules/i-json/index.js:6
        if (typeof arg == "string") return this._update(new Buffer(arg, 'utf8'));
                                                ^
Error: line 1: syntax error near b\b@gmail.com"
    at Parser.nat.Parser.update (/Users/dignifiedquire/work/codio/experiments/json/node_modules/i-json/index.js:6:43)
    at /Users/dignifiedquire/work/codio/experiments/json/async.js:20:39
    at Array.map (native)
    at Object.exports.parse (/Users/dignifiedquire/work/codio/experiments/json/async.js:19:30)
    at /Users/dignifiedquire/work/codio/experiments/json/naive.js:34:10
    at time (/Users/dignifiedquire/work/codio/experiments/json/naive.js:21:5)
    at Object.<anonymous> (/Users/dignifiedquire/work/codio/experiments/json/naive.js:33:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

The second one clang.ops.json (120mb) which you can find here (https://dl.dropboxusercontent.com/u/6672418/clang.ops.json) fails with

[1]    67130 segmentation fault  node naive.js

parser is incorrect

Tried parsing the following file with both c++ & javascript implementation

[
  {
    "key": "datacenter",
    "city_id": 302,
    "value": "us-east1"
  },
  {
    "key": "datacenter.redirect",
    "city_id": 301,
    "value": false
  },
  {
    "key": "territory.enabled",
    "city_id": 300,
    "value": false
  },
  {
    "key": "webview.enabled",
    "city_id": null,
    "value": false
  },
  {
    "key": "express.version",
    "city_id": null,
    "value": 3
  }
]

The C++ parser reported the last value as 0 instead of 3. The js parser threw an uncaught.

Materialization of individual properties

Materialization of the entire JSON object is sometimes unnecessary because only a few fields are accessed. For example, a long list requiring 15ms to parse may be accessed conditionally based on other properties of the object. If the properties can be materialized independently, the expensive parsing operation can be deferred until it is known if the data is actually required.

Do you have a sense of how difficult it might be to modify i-json to materialize only a requested property (perhaps via a V8 accessor or interceptor) instead of returning the entire object?

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.