On Thu, Jul 2, 2009 at 5:14 PM, Brian Candler<[email protected]> wrote: > On Thu, Jul 02, 2009 at 06:16:11PM +0100, Jason Davies wrote: >> Nice work! I'd be interested to see what kind of performance increase >> we get from Spidermonkey 1.8.1, which comes with native JSON parsing/ >> encoding. > > I noted that main.js already uses native JSON parsing, in the sense of > eval(). But the JSON encoding clearly could benefit from speeding up. > > Rather than migrate completely to 1.8.1, would it be possible to bolt on a > JSON.encode C extension to 1.7? (Although of course that still involves > building a custom 1.7, unless js has a way to dynamically load extensions) >
You don't need to load anything into spidermonkey for native encoding, just create a C function that can parse JSON and load it into the context. You can see the examples of things like print and evalcx that are already in couch_js.c
