Details
-
Improvement
-
Resolution: Unresolved
-
Minor
-
3.0.2
-
Security Level: Public
-
None
-
All versions of couchbase- pertaining mostly to the V8 based ones.
Description
CouchDB offers a 'lib' section of the design document that enables you to use common-js style libraries.
I feel like the couchbase view engine's performance will be forever held-back from handling larger calculations without this feature.
I remember somebody raising issue with the potential of having a global mutable state between views- but this kind of abuse is already possible with the global state exposed in the map functions (in fact it is the only workaround to this problem that i have seen). This is of course unsupported.
I would really like to see some sort of modules feature built in to the couchbase JS views. This opens up a whole new world of opportunity for things like image processing, machine learning, data mining, statistical modeling and so much more that requires a large library.
V8 Contexts allow you to build a context and re-enter it safely without modifying the original context. Im not sure what extent this is already done in the view-engine, but its an almost sure-fire way to provide separation if it is needed (if even just for chunks of documents, and not a new context for each document).
Again this is mostly a performance thing. You can always pack the 600kb library you want in your map function, but you're forced to re-initialize the library with every document.
CouchDB has offered several great solutions to this problem:
http://wiki.apache.org/couchdb/JavascriptPatternViewCommonJs