Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 50139 invoked from network); 18 Nov 2009 21:04:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Nov 2009 21:04:58 -0000 Received: (qmail 51375 invoked by uid 500); 18 Nov 2009 21:04:57 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 51290 invoked by uid 500); 18 Nov 2009 21:04:57 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 51280 invoked by uid 99); 18 Nov 2009 21:04:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Nov 2009 21:04:57 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jchris@gmail.com designates 209.85.216.202 as permitted sender) Received: from [209.85.216.202] (HELO mail-px0-f202.google.com) (209.85.216.202) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Nov 2009 21:04:53 +0000 Received: by pxi40 with SMTP id 40so1000528pxi.13 for ; Wed, 18 Nov 2009 13:04:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type; bh=oWr+dW2j1vTY8usiauiIeC9CgSq/QHcOqKGgwl96jnk=; b=V8N7FY1EwkHaQjJY8ZcU25kD/6Eb6/QP/PrRBSvpX8hndtswCRKV+q3SUUi8iI2N9/ R6BrXXy/Cb6h5CWu9av89i+g8eljS2Vzoh9XkdZpVeaiFyxiZnRwkxkZEjioIYS1m97a LJOdjey9Pu1pQwuOYYok8+6iLmEF/Mbx7R0+M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=waDeKT2MKqQDMGN0DPqvewZ5joUqfD0f+3Z4oGXrVh/DLcjYFdVOF9ZMF6Sn0Fd9eQ DRJp3cPGw+pmrTWBYKo/UTHqxUCfzFy/fzP/fe1nj038scPuYY68U03hCB1DSmnU0FaY JqTc5HjJ+wVoGbczzddZ3MU2jl8cYw7PG3tpo= MIME-Version: 1.0 Sender: jchris@gmail.com Received: by 10.143.21.29 with SMTP id y29mr1303101wfi.175.1258578272754; Wed, 18 Nov 2009 13:04:32 -0800 (PST) In-Reply-To: References: <30747dfa0911180958w5a28f4a5j2dd7b3b3c2062660@mail.gmail.com> Date: Wed, 18 Nov 2009 13:04:32 -0800 X-Google-Sender-Auth: fd59ff4956c2e677 Message-ID: Subject: Re: Increasing Spidermonkey version From: Chris Anderson To: dev@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 On Wed, Nov 18, 2009 at 11:52 AM, Paul Davis wrote: > On Wed, Nov 18, 2009 at 12:58 PM, Mikeal Rogers wrote: >> CouchDB currently uses Spidermonkey 1.7 as it's javascript interpreter. >> >> 1.7 was released in 2007. 1.8.5 is the current version number used in trunk, >> anything 1.8.1 should have tracing support and should be much improved in >> terms of performance. >> >> 1.8.x also has a lot of new JavaScript features that would be incredibly >> useful in views (array comprehensions would be a godsend). >> >> Mozilla also has a native JSON parser written in C which is something like >> 2.7 times faster than eval. >> >> http://blog.mozilla.com/webdev/2009/02/12/native-json-in-firefox-31/ >> >> I'm wondering what barriers, if any, there are to increasing the required >> Spidermonkey version. I've also been told that there are some issues with >> using the C based JSON parser because of the way undefined is encoded in >> arrays and would like a little more clarity on what work would need to >> happen to get that in. >> >> My biggest concern is that as more view servers are implemented in other >> languages javascript becomes the "slow" option, which seems ridiculous given >> the performance leapfrogging in recent years between js interpreters. In my >> tests the biggest speed differential appears to be JSON parsing: >> >> http://www.mikealrogers.com/archives/673 >> >> -Mikeal >> > > Mikeal, > > Excellent break down in the blog post and I agree 100%. The biggest > place that the JS view server could currently benefit is in the JSON > parsing. The C parser in 1.8.1 does have a measurable difference [1]. > You're also correct in point out that the new spec is slightly > different than the json.js behavior we currently have. > > John Resig points out [2] that json2.js gives the ECMA5 behavior and > transparently falls back to the native implementation when it exists. > In terms of upgrade path, if we replace json.js with json2.js and fix > the resulting errors we should be able to use any version of > Spidermonkey from 1.7 onwards. Currently, the build system should > handle each version just fine, so it should just be a matter of fixing > the slightly different json2 behavior (which only affects two or three > tests if memory serves). It'd be happy to make the switch to the newer spidermonkey. I don't think we need to sweat the 'undefined' handling details. When we chose JavaScript, it was because it is ubiquitous and simple. We've got some code that expects a particular handling of 'undefined', but if the language is changing (native JSON support for a different handling of 'undefined') I think we should change with the language. It's in CouchDB's interest to follow the prevailing wind here. Does anyone know the status of native JSON support on other browsers, and how 'undefined' is handled? Chris > > Also, I'm hesitant to upgrade our minimum version requirement. The SM > release story is less than awesome. The only tarballs at [3] are for > 1.7 and 1.8.0 which is a weird limbo version between 1.7 and 1.8.1. > Not to mention its got a whacky build system that requires a specific > version of Autoconf. So, yeah, making the upgrades progressive would > be awesome. > > Oh, heh, looks like I said the same thing before. I would rephrase the > "shows up in package managers" now to "has a release of some sort". At > the very least having something that I can point people at and say > "That version" would be good. > > Paul Davis > > [1] http://www.davispj.com/2009/05/18/couchdb-timings.html > [2] http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ > [3] http://ftp.mozilla.org/pub/mozilla.org/js/ > -- Chris Anderson http://jchrisa.net http://couch.io