{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":133872864,"defaultBranch":"main","name":"couchdb","ownerLogin":"nickva","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2018-05-17T22:02:46.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/211822?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1680019607.207314","currentOid":""},"activityList":{"items":[{"before":"5148700e0368ba97a298e6039f3a04b80cc19b69","after":"831c3d93f065756408ae515bbd24880ee67bdac0","ref":"refs/heads/qjs","pushedAt":"2023-05-25T06:08:13.325Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allows granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microseconds, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"488dff0cc9564019d442c5f5338e10619d84207d","after":"5148700e0368ba97a298e6039f3a04b80cc19b69","ref":"refs/heads/qjs","pushedAt":"2023-05-25T05:43:55.864Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allows granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microseconds, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"30c4563453db39b9ad6f7f28bd8193fa43e3653c","after":"488dff0cc9564019d442c5f5338e10619d84207d","ref":"refs/heads/qjs","pushedAt":"2023-05-24T23:58:22.090Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allows granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microseconds, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"7124f444eb1436b00d1a1337a64c51c6251dd27e","after":"30c4563453db39b9ad6f7f28bd8193fa43e3653c","ref":"refs/heads/qjs","pushedAt":"2023-05-23T21:55:24.245Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allows granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microseconds, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"f83d4328d242a9bb69026afc26a53e1104cac3f9","after":"7124f444eb1436b00d1a1337a64c51c6251dd27e","ref":"refs/heads/qjs","pushedAt":"2023-05-21T08:44:30.174Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allows granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microseconds, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"688652bc11db7188d192efc0bc8257ac89f82540","after":"f83d4328d242a9bb69026afc26a53e1104cac3f9","ref":"refs/heads/qjs","pushedAt":"2023-04-17T03:35:41.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allows granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microseconds, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"1432717b154e2986e86da18c78ca843e020a5bfd","after":"4b8b7ec9f39d1e5910f301283fd6b9051b057d0c","ref":"refs/heads/main","pushedAt":"2023-04-17T03:32:44.527Z","pushType":"push","commitsCount":10,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Improve couch_proc_manager\n\nThe main improvement is speeding up process lookup. This should result in\nimproved latency for concurrent requests which quickly acquire and\nrelease couchjs processes. Testing with concurrent vdu and map/reduce calls\nshowed a 1.6 -> 6x performance speedup [1].\n\nPreviously, couch_proc_manager linearly searched through all the processes and\nexecuted a custom callback function for each to match design doc IDs. Instead,\nuse a separate ets table index for idle processes to avoid scanning assigned\nprocesses.\n\nUse a db tag in addition to a ddoc id to quickly find idle processes. This could\nimprove performance, but if that's not the case, allow configuring the tagging\nscheme to use a db prefix only, or disable the scheme altogether.\n\nUse the new `map_get` ets select guard [2] to perform ddoc id lookups during\nthe ets select traversal without a custom matcher callback.\n\nIn ordered ets tables use the partially bound key trick [3]. This helps skip\nscanning processes using a different query language altogether.\n\nWaiting clients used `os:timestamp/0` as a unique client identifier. It turns\nout, `os:timestamp/0` is not guaranteed to be unique and could result in some\nclients never getting a response. This bug was mostly likely the reason the\n\"fifo client order\" test had to be commented out. Fix the issue by using a\nnewer monotonic timestamp function, and for uniqueness add the client's\ngen_server return tag at the end. Uncomment the previously commented out test\nso it can hopefully run again.\n\nWhen clients tag a previously untagged process, asynchronously replace the\nuntagged process with a new process. This happens in the background and the\nclient doesn't have to wait for it.\n\nWhen a ddoc tagged process cannot be found, before giving up, stop the oldest\nunused ddoc processes to allow spawning new fresh ones. To avoid doing a linear\nscan here, keep a separate `?IDLE_ACCESS` index with an ordered list of idle\nddoc proceses sorted by their last usage time.\n\nWhen processes are returned to the pool, quickly respond to the client with an\nearly return, instead of forcing them to wait until we re-insert the process\nback into the idle ets table. This should improve client latency.\n\nIf the waiting client list gets long enough, where it waits longer than the\ngen_server get_proc timeout, do not waste time assigning or spawning a new\nprocess for that client, since it already timed-out.\n\nWhen gathering stats, avoid making gen_server calls, at least for the total\nnumber of processes spawned metric. Table sizes can be easily computed with\n`ets:info(Table, size)` from outside the main process.\n\nIn addition to peformance improvements clean up the couch_proc_manager API by\nforcing all the calls to go through properly exported functions instead of\ndoing direct gen_server calls.\n\nRemove `#proc_int{}` and use only `#proc{}`. The cast to a list/tuple between\n`#proc_int{}` and `#proc{}` was dangerous and it avoided the compiler checking\nthat we're using the proper fields. Adding an extra field to the record\nresulted in mis-matched fields being assigned.\n\nTo simplify the code a bit, keep the per-language count in an ets table. This\nhelps not having to thread the old and updated state everywhere. Everything\nelse was mostly kept in ets tables anyway, so we're staying consistent with\nthat general pattern.\n\nImprove test coverage and convert the tests to use the `?TDEF_FE` macro so\nthere is no need for the awkward `?_test(begin ... end)` construct.\n\n[1] https://gist.github.com/nickva/f088accc958f993235e465b9591e5fac\n[2] https://www.erlang.org/doc/apps/erts/match_spec.html\n[3] https://www.erlang.org/doc/man/ets.html#table-traversal","shortMessageHtmlLink":"Improve couch_proc_manager"}},{"before":"331cc8b4cacab6cd9b3728a7d073f66cb9c09a36","after":"688652bc11db7188d192efc0bc8257ac89f82540","ref":"refs/heads/qjs","pushedAt":"2023-04-10T16:32:56.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allows granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microseconds, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"d1412552f4a88df3b783199a61030568973b152f","after":"1432717b154e2986e86da18c78ca843e020a5bfd","ref":"refs/heads/main","pushedAt":"2023-04-10T16:30:06.247Z","pushType":"push","commitsCount":12,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"docs: Fixed `_compact/{ddoc}` and `_shards/{docid}` examples\n\n- Modified the example and add a `manual view compaction` link to the\napi `/{db}/_compact/{ddoc}` to facilitate users to view `_compact`\nrelated documents.\n\n- Fixed example request for GET /{db}/_shards/{docid}","shortMessageHtmlLink":"docs: Fixed _compact/{ddoc} and _shards/{docid} examples"}},{"before":"dac7534e0446c4f08a2a928366d29a88791ee10f","after":"331cc8b4cacab6cd9b3728a7d073f66cb9c09a36","ref":"refs/heads/qjs","pushedAt":"2023-04-10T15:57:50.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"0b5f53723cc56a42d58ff6e43d0516cf5ffd565e","after":"dac7534e0446c4f08a2a928366d29a88791ee10f","ref":"refs/heads/qjs","pushedAt":"2023-04-02T05:53:24.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"fc60e118e44f4f7094b1173298759e2aa53b7895","after":"0b5f53723cc56a42d58ff6e43d0516cf5ffd565e","ref":"refs/heads/qjs","pushedAt":"2023-04-02T04:57:10.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"4de1c7dea19f81a2b457040c7d5d34169cab5469","after":"fc60e118e44f4f7094b1173298759e2aa53b7895","ref":"refs/heads/qjs","pushedAt":"2023-04-02T04:07:14.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"787bc72adae20f07aa07ce059aeea93eb0e58e41","after":"4de1c7dea19f81a2b457040c7d5d34169cab5469","ref":"refs/heads/qjs","pushedAt":"2023-04-01T03:49:16.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"96cee3e8bd76689f79ef55fd7718d55d62b1ee5b","after":"787bc72adae20f07aa07ce059aeea93eb0e58e41","ref":"refs/heads/qjs","pushedAt":"2023-03-31T22:33:00.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"aab990caffd6c59fa9b7ee01d06f18930f1e69c8","after":"96cee3e8bd76689f79ef55fd7718d55d62b1ee5b","ref":"refs/heads/qjs","pushedAt":"2023-03-31T22:25:07.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"4a4a9576423559dd26ae77358ebdb07e07c29bfa","after":"aab990caffd6c59fa9b7ee01d06f18930f1e69c8","ref":"refs/heads/qjs","pushedAt":"2023-03-31T21:54:40.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 4x faster than SM 1.8.5\n - 5x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"f5d0310f90da6069ba0ae98c8d7de95ac2380a34","after":"4a4a9576423559dd26ae77358ebdb07e07c29bfa","ref":"refs/heads/qjs","pushedAt":"2023-03-31T21:50:25.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 3x faster than SM 1.8.5\n - 4x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"23efd8e5b1aa96ef01640fec03a5fedc945ba8b9","after":"d1412552f4a88df3b783199a61030568973b152f","ref":"refs/heads/main","pushedAt":"2023-03-31T21:10:36.596Z","pushType":"push","commitsCount":88,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"docs(hosts): Remove misleading /etc/hosts info (#4506)","shortMessageHtmlLink":"docs(hosts): Remove misleading /etc/hosts info (apache#4506)"}},{"before":"0f3a969891458c13a1c774facfa920eacea314a5","after":"f5d0310f90da6069ba0ae98c8d7de95ac2380a34","ref":"refs/heads/qjs","pushedAt":"2023-03-31T19:58:41.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS as a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 3x faster than SM 1.8.5\n - 4x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\n * Allows compiling JS bytecode ahead of time a C array of bytes.\n\nQuickJS can be built alongside spidermonkey and toggled on/off at runtime:\n\n```\n./configure --dev --js-engine=quickjs\n```\n\nThis makes it the default engine. But spidermonkey can still be set in the\nconfig option.\n\n```\n[couchdb]\njs_engine = spidermonkey | quickjs\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.","shortMessageHtmlLink":"Add QuickJS as a Javascript engine option"}},{"before":"cf88b1fcad5a22d0e0af98def2f7142b658aab2c","after":"0f3a969891458c13a1c774facfa920eacea314a5","ref":"refs/heads/qjs","pushedAt":"2023-03-31T19:30:57.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS is a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 3x faster than SM 1.8.5\n - 4x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\nFor now to make it easy to experiment added it in as a JS \"version\" enabled at\ncompile time.\n\n```\n./configure --dev --spidermonkey-version quickjs && make\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.\n\nQuickJS Patches:\n * Disable workers. (Brings in pthread, etc)\n * Enable spidermonkey 1.8.5 function expression mode","shortMessageHtmlLink":"Add QuickJS is a Javascript engine option"}},{"before":null,"after":"cf88b1fcad5a22d0e0af98def2f7142b658aab2c","ref":"refs/heads/qjs-separate-js-file","pushedAt":"2023-03-28T16:06:47.207Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS is a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 3x faster than SM 1.8.5\n - 4x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\nFor now to make it easy to experiment added it in as a JS \"version\" enabled at\ncompile time.\n\n```\n./configure --dev --spidermonkey-version quickjs && make\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.\n\nQuickJS Patches:\n * Disable workers. (Brings in pthread, etc)\n * Enable spidermonkey 1.8.5 function expression mode","shortMessageHtmlLink":"Add QuickJS is a Javascript engine option"}},{"before":"db863084ec66a4ca430f092309a68369fa9b1601","after":"cf88b1fcad5a22d0e0af98def2f7142b658aab2c","ref":"refs/heads/qjs","pushedAt":"2023-03-20T22:43:39.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS is a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 3x faster than SM 1.8.5\n - 4x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\nFor now to make it easy to experiment added it in as a JS \"version\" enabled at\ncompile time.\n\n```\n./configure --dev --spidermonkey-version quickjs && make\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.\n\nQuickJS Patches:\n * Disable workers. (Brings in pthread, etc)\n * Enable spidermonkey 1.8.5 function expression mode","shortMessageHtmlLink":"Add QuickJS is a Javascript engine option"}},{"before":"7ddb825c3b90e19f7f38b6166bd97b322c7458b5","after":"db863084ec66a4ca430f092309a68369fa9b1601","ref":"refs/heads/qjs","pushedAt":"2023-03-19T18:05:20.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS is a Javascript engine option\n\nhttps://bellard.org/quickjs\nhttps://fuchsia.googlesource.com/third_party/quickjs/\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 3x faster than SM 1.8.5\n - 4x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\nFor now to make it easy to experiment added it in as a JS \"version\" enabled at\ncompile time.\n\n```\n./configure --dev --spidermonkey-version quickjs && make\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.\n\nQuickJS Patches:\n * Disable workers. (Brings in pthread, etc)\n * Enable spidermonkey 1.8.5 function expression mode","shortMessageHtmlLink":"Add QuickJS is a Javascript engine option"}},{"before":"9b5c4d467648f83b3692ec87256d5565e913d607","after":"7ddb825c3b90e19f7f38b6166bd97b322c7458b5","ref":"refs/heads/qjs","pushedAt":"2023-03-16T22:43:18.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS is a Javascript engine option\n\nhttps://bellard.org/quickjs\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Results seem promising:\n - 3x faster than SM 1.8.5\n - 4x faster than SM 91\n - 6x reduced memory usage per couchjs process (5MB vs 30MB)\n\nFor now to make it easy to experiment added it in as a JS \"version\" enabled at\ncompile time.\n\n```\n./configure --dev --spidermonkey-version quickjs && make\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.\n\nQuickJS Patches:\n * Disable workers. (Brings in pthread, etc)\n * Enable spidermonkey 1.8.5 function expression mode","shortMessageHtmlLink":"Add QuickJS is a Javascript engine option"}},{"before":"df073e43e2148441cc99c16a64c83df43ce6ab9e","after":"9b5c4d467648f83b3692ec87256d5565e913d607","ref":"refs/heads/qjs","pushedAt":"2023-03-16T22:19:21.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS is a Javascript engine option\n\nhttps://bellard.org/quickjs\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\n * Seems to be faster in preliminary benchmarking with small\n concurrent VDU and view builds:\n https://gist.github.com/nickva/ed239651114794ebb138b1f16c5f6758\n Looks like 3x faster than SM 1.8.5 and 4x faster than SM 91.\n\nFor now to make it easy to experiment added it in as a JS \"version\" enabled at\ncompile time.\n\n```\n./configure --dev --spidermonkey-version quickjs && make\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.\n\nQuickJS Patches:\n * Disable workers. (Brings in pthread, etc)\n * Enable spidermonkey 1.8.5 function expression mode","shortMessageHtmlLink":"Add QuickJS is a Javascript engine option"}},{"before":"1e3ec22b5870572eb8938725db33f18375199243","after":"df073e43e2148441cc99c16a64c83df43ce6ab9e","ref":"refs/heads/qjs","pushedAt":"2023-03-16T19:46:51.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS is a Javascript engine option\n\nhttps://bellard.org/quickjs\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\nFor now to make it easy to experiment added it in as a JS \"version\" enabled at\ncompile time.\n\n```\n./configure --dev --spidermonkey-version quickjs && make\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.\n\nQuickJS Patches:\n * Disable workers. (Brings in pthread, etc)\n * Enable spidermonkey 1.8.5 function expression mode","shortMessageHtmlLink":"Add QuickJS is a Javascript engine option"}},{"before":"4bb8a04a2306bfeaf7a9f420ae8568c129707dec","after":"1e3ec22b5870572eb8938725db33f18375199243","ref":"refs/heads/qjs","pushedAt":"2023-03-16T16:40:09.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"Add QuickJS is a Javascript engine option\n\nhttps://bellard.org/quickjs\n\nSome benefits over SM:\n\n * Small. We're using 6 or so C files vs 700+ SM91 C++ files.\n\n * Built with Apache CouchDB as opposed having to maintain a separate SM\n package, like for RHEL9, for instance, where they dropped support for SM\n already. (see https://github.com/apache/couchdb/issues/4154).\n\n * Embedding friendly. Designed from ground-up for embedding. SM has been\n updating the C++ API such that we have to keep copy-pasting new versions of\n our C++ code every year or so. (see\n https://github.com/apache/couchdb/pull/4305).\n\n * Easy to modify to accept Spidermonkey 1.8.5 top level functions for\n map/reduce code so we don't have have to parse the JS, AST trasform it, and\n then re-compile it.\n\n * Configurable runtime feature set - can disable workers, promises and other\n API and features which may not work well in a backend JS environment. Some\n users may want more, some may want to disable even Date(time) features to\n hedge again Spectre-style attacks (spectreattack.com).\n\n * Allow granular time (reduction) trackign if we wanted to provide a runtime\n allowance for each function.\n\n * Better sandboxing. Creating a whole JSRuntime takes only 300 microsecond, so\n we can afford to do that on reset. JSRuntimes cannot share JS data or object\n between them.\n\nFor now to make it easy to experiment added it in as a JS \"version\" enabled at\ncompile time.\n\n```\n./configure --dev --spidermonkey-version quickjs && make\n```\n\nOnly tested on MacOS and Linux. All `make check` tests pass there.\n\nQuickJS Patches:\n * Disable workers. (Brings in pthread, etc)\n * Enable spidermonkey 1.8.5 function expression mode","shortMessageHtmlLink":"Add QuickJS is a Javascript engine option"}},{"before":"16b19aee537c49dafa1414ac8e572e7c9757cda3","after":"4bb8a04a2306bfeaf7a9f420ae8568c129707dec","ref":"refs/heads/qjs","pushedAt":"2023-03-14T16:23:46.693Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"nickva","name":"Nick Vatamaniuc","path":"/nickva","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/211822?s=80&v=4"},"commit":{"message":"QuickJS import\n\nmain.c is unfinished (wip)\n\nPatches:\n * Disable workers. (Brings in pthread, etc)\n * Enable spidermonkey 1.8.5 function expression mode","shortMessageHtmlLink":"QuickJS import"}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAADM9d9DQA","startCursor":null,"endCursor":null}},"title":"Activity ยท nickva/couchdb"}