diff options
author | Cheng Shao <astrohavoc@gmail.com> | 2022-09-09 17:45:45 +0000 |
---|---|---|
committer | Cheng Shao <astrohavoc@gmail.com> | 2022-11-16 09:16:29 +0000 |
commit | 08bf28819b78e740550a73a90eda62cce8d21c90 (patch) | |
tree | 38dd14258332f5fc8ca4798d37968723a0ad873b /hadrian | |
parent | 02d3511b8d248ea9429512830f8f17b31688a6a6 (diff) | |
download | haskell-08bf28819b78e740550a73a90eda62cce8d21c90.tar.gz |
base: make Foreign.Marshal.Pool use RTS internal arena for allocation
`Foreign.Marshal.Pool` used to call `malloc` once for each allocation
request. Each `Pool` maintained a list of allocated pointers, and
traverses the list to `free` each one of those pointers. The extra O(n)
overhead is apparently bad for a `Pool` that serves a lot of small
allocation requests.
This patch uses the RTS internal arena to implement `Pool`, with these
benefits:
- Gets rid of the extra O(n) overhead.
- The RTS arena is simply a bump allocator backed by the block
allocator, each allocation request is likely faster than a libc
`malloc` call.
Closes #14762 #18338.
Diffstat (limited to 'hadrian')
0 files changed, 0 insertions, 0 deletions