couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <>
Subject Re: helper functions in reduce
Date Wed, 11 Mar 2009 07:29:14 GMT

On 11 Mar 2009, at 02:29, Chris Anderson wrote:

> On Tue, Mar 10, 2009 at 6:18 PM, kowsik <> wrote:
>> And the source code as defined in the view is parsed and executed
>> __each__ time reduce is called on the changed docs. I think the  
>> intent
>> was that the view server has no clue when _design views actually
>> change. So couchdb passes in the actual string corresponding to the
>> view function each time it wants couchjs to reduce a bunch of
>> key/values. I suppose you could precompile these functions in the  
>> view
>> server and have it return "handles" to couchdb that can be used at a
>> later stage.
> We've discussed a little on IRC, how to optimize this. The plan so
> far, is to maintain in CouchDB's ets tables of couchjs processes, a
> list of functions known by each process (where functions are named by
> their md5 hash). When a function is passed to a query server, it'll be
> passed along with its name, the first time. If a server already knows
> about the function, Couch will just pass the name in subsequent
> requests. If they somehow get out of sync CouchDB can just kill that
> server and start fresh.
> This also means that if you have lots of dbs with the same views in
> them, you get nice reuse of couchjs processes.
> Anyone feel like implementing? ;)

*cough* …maybe dev@.


View raw message