From c482ee402502cee8bbea7fcb107d44de586bfc49 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 1 Apr 2022 13:26:07 -0400 Subject: Make heap page sizes 64KiB by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit dde164e968e382d50b07ad4559468885cbff33ef decoupled incremental marking from page sizes. This commit changes Ruby heap page sizes to 64KiB. Doing so will have several benefits: 1. We can use compaction on systems with 64KiB system page sizes (e.g. PowerPC). 2. Larger page sizes will allow Variable Width Allocation to increase slot sizes and embed larger objects. 3. Since commit 002fa2859962f22de8afdbeece04966ea57b7da9, macOS has 64 KiB pages. Making page sizes 64 KiB will bring these systems to parity. I have attached some bechmark results below. Discourse: On Discourse, we saw much better p99 performance (e.g. for "categories" it went from 214ms on master to 134ms on branch, for "home" it went from 265ms to 251ms). We don’t see much change in p60, p75, and p90 performance. We also see a slight decrease in memory usage by 1.04x. Branch RSS: 354.9MB Master RSS: 368.2MB railsbench: On rails bench, we don’t see a big change in RPS or p99 performance. We don’t see a big difference in memory usage. Branch RPS: 826.27 Master RPS: 824.85 Branch p99: 1.67 Master p99: 1.72 Branch RSS: 88.72MB Master RSS: 88.48MB liquid: We don’t see a significant change in liquid performance. Branch parse & render: 28.653 I/s Master parse & render: 28.563 i/s --- gc.c | 9 ++------- misc/lldb_cruby.py | 5 +---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/gc.c b/gc.c index bfd06200c0..9caa67accc 100644 --- a/gc.c +++ b/gc.c @@ -858,14 +858,9 @@ typedef struct rb_objspace { } rb_objspace_t; -#if defined(__APPLE__) && defined(__LP64__) && !defined(HEAP_PAGE_ALIGN_LOG) -/* for slow mmap: 64KiB */ -#define HEAP_PAGE_ALIGN_LOG 16 -#endif - #ifndef HEAP_PAGE_ALIGN_LOG -/* default tiny heap size: 16KB */ -#define HEAP_PAGE_ALIGN_LOG 14 +/* default tiny heap size: 64KiB */ +#define HEAP_PAGE_ALIGN_LOG 16 #endif #define BASE_SLOT_SIZE sizeof(RVALUE) diff --git a/misc/lldb_cruby.py b/misc/lldb_cruby.py index 15d17d46da..e7f7003214 100755 --- a/misc/lldb_cruby.py +++ b/misc/lldb_cruby.py @@ -12,10 +12,7 @@ import os import shlex import platform -if platform.system() == 'Darwin': - HEAP_PAGE_ALIGN_LOG = 16 -else: - HEAP_PAGE_ALIGN_LOG = 14 +HEAP_PAGE_ALIGN_LOG = 16 HEAP_PAGE_ALIGN_MASK = (~(~0 << HEAP_PAGE_ALIGN_LOG)) HEAP_PAGE_ALIGN = (1 << HEAP_PAGE_ALIGN_LOG) -- cgit v1.2.3