Arc Forumnew | comments | leaders | submitlogin
1 point by aw 5234 days ago | link | parent

This appears to be a bug in the JSON parser...

  $ mzscheme
  Welcome to MzScheme v4.1.5 [3m], Copyright (c) 2004-2009 PLT Scheme Inc.
  > (require (planet dherman/json:3:0))
  > (read-json (open-input-string "3.1"))
  read: expected: digits, got: .
I'll take a look at the JSON parser you ported.

It will be a better test anyway... the two different JSON parsers might have very different speeds for all we know.



1 point by akkartik 5234 days ago | link

I just tried it with the version I already have.

  (time:deepcopy:w/infile f "x" (json-read f))
  time: 5874 msec.
  (time:w/infile f "x" (json-read f))
  time: 3953 msec.
So at least here it's within a factor of 2. Pretty useable.

-----

1 point by aw 5234 days ago | link

Yeah, be sure to try each test multiple times. You can get that much of a variance simply from the garbage collector running at one time but another, from the file needing to be read from disk vs. already cached in memory by the operating system, some other process hitting the CPU, or in EC2, the virtual CPU getting fewer cycles at the moment...

-----

1 point by akkartik 5234 days ago | link

Yeah it's fairly consistent. I've tried experiments where I interleave the two versions and compute an average.

-----

1 point by akkartik 5232 days ago | link

I just switched to this version (also in anarki). I was seeing errors with unicode escape sequences, and this bug was just easier to fix.

-----

1 point by aw 5232 days ago | link

Good! I wanted to see if the latest code would work with the hackinator, so I grabbed a copy from Anarki and updated the deepcopy code:

  $ hack ycombinator.com/arc/arc3.1.tar \
         awwx.ws/ac0.hack \
         awwx.ws/scheme-json0.hack
Seems to work. (require (file "lib/.../foo.ss")) appears to be the right thing to do for .ss files; a Scheme load uses Arc's readtable which messes up on square brackets, and a plain (require "lib/.../foo.ss") doesn't like periods in directory names.

-----