1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00
denoland-deno/core/libdeno
Bert Belder 41c7e96f1a
Refactor zero-copy buffers for performance and to prevent memory leaks
* In order to prevent ArrayBuffers from getting garbage collected by V8,
  we used to store a v8::Persistent<ArrayBuffer> in a map. This patch
  introduces a custom ArrayBuffer allocator which doesn't use Persistent
  handles, but instead stores a pointer to the actual ArrayBuffer data
  alongside with a reference count. Since creating Persistent handles
  has quite a bit of overhead, this change significantly increases
  performance. Various HTTP server benchmarks report about 5-10% more
  requests per second than before.

* Previously the Persistent handle that prevented garbage collection had
  to be released manually, and this wasn't always done, which was
  causing memory leaks. This has been resolved by introducing a new
  `PinnedBuf` type in both Rust and C++ that automatically re-enables
  garbage collection when it goes out of scope.

* Zero-copy buffers are now correctly wrapped in an Option if there is a
  possibility that they're not present. This clears up a correctness
  issue where we were creating zero-length slices from a null pointer,
  which is against the rules.
2019-05-01 21:11:09 +02:00
..
api.cc Refactor zero-copy buffers for performance and to prevent memory leaks 2019-05-01 21:11:09 +02:00
binding.cc Refactor zero-copy buffers for performance and to prevent memory leaks 2019-05-01 21:11:09 +02:00
buffer.h Refactor zero-copy buffers for performance and to prevent memory leaks 2019-05-01 21:11:09 +02:00
BUILD.gn Refactor zero-copy buffers for performance and to prevent memory leaks 2019-05-01 21:11:09 +02:00
deno.h Refactor zero-copy buffers for performance and to prevent memory leaks 2019-05-01 21:11:09 +02:00
exceptions.cc Move //libdeno to //core/libdeno (#2015) 2019-03-30 14:45:36 -04:00
exceptions.h Move //libdeno to //core/libdeno (#2015) 2019-03-30 14:45:36 -04:00
file_util.cc Move //libdeno to //core/libdeno (#2015) 2019-03-30 14:45:36 -04:00
file_util.h Move //libdeno to //core/libdeno (#2015) 2019-03-30 14:45:36 -04:00
file_util_test.cc Rename test targets (#2262) 2019-05-01 09:48:56 -04:00
internal.h Refactor zero-copy buffers for performance and to prevent memory leaks 2019-05-01 21:11:09 +02:00
libdeno.d.ts Move //libdeno to //core/libdeno (#2015) 2019-03-30 14:45:36 -04:00
libdeno_test.cc Refactor zero-copy buffers for performance and to prevent memory leaks 2019-05-01 21:11:09 +02:00
libdeno_test.js Move //libdeno to //core/libdeno (#2015) 2019-03-30 14:45:36 -04:00
modules.cc Move //libdeno to //core/libdeno (#2015) 2019-03-30 14:45:36 -04:00
modules_test.cc Refactor zero-copy buffers for performance and to prevent memory leaks 2019-05-01 21:11:09 +02:00
snapshot_creator.cc core: snapshot improvements (#2052) 2019-04-08 10:12:43 -04:00
test.cc core: snapshot improvements (#2052) 2019-04-08 10:12:43 -04:00
test.h Refactor zero-copy buffers for performance and to prevent memory leaks 2019-05-01 21:11:09 +02:00