summaryrefslogtreecommitdiff
path: root/core/libdeno/buffer.h
AgeCommit message (Collapse)Author
2020-01-05Replace libdeno with rusty_v8 (#3556)Ry Dahl
2020-01-02Happy new year! (#3578)Ry Dahl
2019-12-08Replace deprecated GetContent with GetBackingStore (#3458)Kevin (Kun) "Kassimo" Qian
2019-09-15Move GN root into //core/libdeno (#2943)Christian Moritz
2019-05-11core: make PinnedBuf::Raw -> PinnedBuf conversion actually a moveBert Belder
2019-05-01Refactor zero-copy buffers for performance and to prevent memory leaksBert Belder
* 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.