couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filipe David Manana <fdman...@apache.org>
Subject Re: CommonJS module updates
Date Tue, 22 Feb 2011 16:55:40 GMT
For the caching there's already a Jira ticket somewhere.
Can you attach the patch there?

On Tue, Feb 22, 2011 at 4:47 PM, Caolan McMahon
<caolan.mcmahon@gmail.com> wrote:
> As some of you may know, I've been working on a couchapp framework
> which makes heavy use of commonjs modules (http://kansojs.org). While
> developing this I've run into a number of issues which prevent the use
> of some modules, and makes writing my own more difficult:
>
> 1. Modules are not cached - eval'ing a complex application, consisting
> of many modules on each request would have an impact on performance.
> It also means you can't use modules which use the module object to
> store state. This is commonly used by template libraries to store
> loaded templates in a cache, or 'memoize' expensive functions.
>
> 2. Circular dependencies blow the stack - Its not possible to require
> module A from module B, if module B also requires module A. This
> happens more often than you might think, and is handled by other
> require() implementations by setting the cached module to an empty
> object before eval'ing it. The fix for this requires a module cache to
> be in place.
>
>
> Since these are really hindering progress, I've forked on github and
> committed my proposed patches with associated tests:
> https://github.com/caolan/couchdb/compare/7f553e82ef...6c66675a23
>
> Please, if you have time, review the code and provide me with your feedback.
>
>
> Thanks,
>
> Caolan
>



-- 
Filipe David Manana,
fdmanana@gmail.com, fdmanana@apache.org

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

Mime
View raw message