couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kowsik <>
Subject Re: helper functions in reduce
Date Wed, 11 Mar 2009 01:18:11 GMT
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.

But, I don't think anyone has benchmarked the view server to see where
it's spending the most amount of time to implement these


On Tue, Mar 10, 2009 at 5:10 PM, Jens Alfke <> wrote:
> On Mar 9, 2009, at 5:31 PM, Adam Wolff wrote:
>> but it bothers me a little that those three functions are defined every
>> time
>> that reduce is run.
> They're not. They're defined when the source code is parsed, not when it's
> run. The only difference it makes to have them inside the reduce function is
> that they can access local variables of that function. There shouldn't be
> any difference in speed.
> —Jens

View raw message