Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 7282 invoked from network); 23 Oct 2008 17:08:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Oct 2008 17:08:32 -0000 Received: (qmail 68366 invoked by uid 500); 23 Oct 2008 17:08:34 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 68337 invoked by uid 500); 23 Oct 2008 17:08:34 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 68326 invoked by uid 99); 23 Oct 2008 17:08:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2008 10:08:34 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kowsik@gmail.com designates 74.125.92.150 as permitted sender) Received: from [74.125.92.150] (HELO qw-out-1920.google.com) (74.125.92.150) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2008 17:07:24 +0000 Received: by qw-out-1920.google.com with SMTP id 4so188237qwk.54 for ; Thu, 23 Oct 2008 10:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=Ehs7yN8ExID7Rx8DQzCawDkekOPPyc2IhWtYusE6Fps=; b=BnYTIfZPC1Bcp3zggKcefgs5irKjIRyAAkPPjt5EBXc8tJRentN87PLcG00Jed5OaK +OkCW/35Plw0ofkwgG9lMuk3F2Ve4UlYH2rUfQOiX+3Oi9NydVkCz4HI40SH399/cVrX VVXDVeZQvZe3/CrpumCFR/kjNaxfvtvQiVCSQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=KGgZ1FSYPnrWKAjYv835MzYw6SB433TDISCYCYdGd4cBNOZXn+GCF/vutxfp3qBTlp UqexeDeVupbIFZW74/4KkCnzvVhqe+NHhDBUk+jtpsVidrrVA8NLeB5mYLxV4VBs0mWu SVy9QR7bEe01dNIBtKWJNAdQPx3XvATEgaDNg= Received: by 10.214.43.9 with SMTP id q9mr1628539qaq.21.1224781682806; Thu, 23 Oct 2008 10:08:02 -0700 (PDT) Received: by 10.214.12.19 with HTTP; Thu, 23 Oct 2008 10:08:02 -0700 (PDT) Message-ID: <7db9abd30810231008y48d82461y576ed85a0d3692df@mail.gmail.com> Date: Thu, 23 Oct 2008 10:08:02 -0700 From: kowsik To: couchdb-user@incubator.apache.org Subject: Re: Question on view server design... In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7db9abd30810230935u266ebf9tc49cf8bf5e7838b7@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org No, not explicitly, but I was looking at evalcx which sets up and tears down a new JSContext each time a function is compiled. Just wondering if there's an incremental way of doing this so we don't incur the overhead each time reduce is invoked. Maybe with TraceMonkey, this is a moot point? ;-) K. On Thu, Oct 23, 2008 at 9:42 AM, Jan Lehnardt wrote: > > On Oct 23, 2008, at 18:35, kowsik wrote: > >> I was seeing the couchjs process getting pegged and I was looking into >> further. >> >> 1. The protocol uses "add_fun" command to add all the map functions to >> the view server so that they are compiled and ready to go. >> 2. Then "map_doc" is invoked with each document to return the results >> of the various emit's >> 3. They "reduce" and "rereduce" are invoked depending on the query. >> >> It's #3 that I'm interested in. The "reduce" command currently passes >> in the reduce function string from the design view each time it's >> invoked. This means the reduce function is first eval'd and then >> executed. I'm wondering if it's possible to rename "add_fun" to >> "add_map_fun" and introduce a new "add_reduce_fun" and then reference >> functions by index? Seems like it might speed things up quite a bit. > > Have you measured the reduce function compilation to be a bottleneck? > I'd guess (see, haven't measured either:-) that erlang-term to JSON & JSON > parsing take up significantly more time. > > Cheers > Jan > -- >