couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Osher E (Commented) (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-890) Option to use a persistent CommonJS module cache
Date Thu, 16 Feb 2012 09:38:59 GMT


Osher E commented on COUCHDB-890:

I do not know what the appointed patch means, but I'm in the believe that a simple solution
can be made:

by wrapping the 'native' require function with a requirer of our own, we can keep alive the
execution-context of a certain view, where this context would be used whenever new documents
need to be indexed to the view. it means that a design-document with several views will have
such execution context per view,
This execution context will hold the view-level instances to the evaluated modules.

>From the other side - a reverse index is held, which references the view execution-contexts
for all the views it is involved in.

Once the design-document is updated, every module that field a check-sum check (i.e changed)
will invalidate all the views that it is part of.

I would love to help and offer pull-requests if someone would help me get started: how to
my own build? how is the server.js is generated? how to debug this? how to edit such sources?
what are the conventions that are followed? I'm GMT+2.

> Option to use a persistent CommonJS module cache
> ------------------------------------------------
>                 Key: COUCHDB-890
>                 URL:
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: JavaScript View Server
>         Environment: All
>            Reporter: mikeal
>         Attachments: commonjscache.diff
> Since COUCHDB-1075, there is a CommonJS module cache used for resolving circular CommonJS
dependencies. However, Caolan reports a 10x speed improvement by not clearing this cache between
requests. An option to not clear the cache could be a great tool for performance-interested
power users who know their CommonJS modules are sane. The improvement will be even greater
when we turn on the JIT compiler in SpiderMonkey since cached modules will benefit from being

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message