You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/09/07 14:55:02 UTC

[GitHub] [couchdb] janl opened a new pull request #3728: feat(views): cache function compilation. Closes #3517.

janl opened a new pull request #3728:
URL: https://github.com/apache/couchdb/pull/3728


   Since supporting SpiderMonkey versions > 1.8.5 we compile design
   doc functions of the form `function(args) { /* impl */ }` into a
   form that is recognise by newer JS engines.
   
   For reduce views, this means a transpilation happens on each
   reduce call over the couchjs protocol, which is once for every
   level in the b+tree plus one final rereduce across all shards.
   
   down reduce view indexing/querying.
   
   This patch adds caching to the compilation function. This is
   implemented by way of producing a SHA-256 hash of all incoming
   JS functions and caching them in a global object in the memory
   of a `couchjs` process.
   
   The cache is cleared when a `add_fun` message is received, which
   happens before new map functions from a new ddoc are loaded into
   `couchjs`. This ensures that only functions from a single view &
   security context are ever loaded into the cache.
   
   SHA-256 was chosen because it is producing collisions that are
   also valid JS functions is unlikley.
   
   This specific SHA-256 implementation was chosen because:
   - it is favourably licensed (MIT)
   - taken from the Deno (https://deno.land) project, (h/t Martin
     Sonnenholzer for the tip)so we can be reasonably assured this
     has been tested thoroughly.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb] AltenTMAOrion commented on pull request #3728: feat(views): cache function compilation. Closes #3517.

Posted by GitBox <gi...@apache.org>.
AltenTMAOrion commented on pull request #3728:
URL: https://github.com/apache/couchdb/pull/3728#issuecomment-986753552


   Hello, 
   
   Do you have any ideas on a date of integration for this patch? 
   We are stuck on couchdb 2.3.1 because of the performance on the map/ reduce design, as our application is mainly based on this feature 
   
   Thank


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org