Skip to content

build: enable pie on linux - #67386

Open
legendecas wants to merge 1 commit into
nodejs:mainfrom
legendecas:build-pie-linux
Open

legendecas wants to merge 1 commit into
nodejs:mainfrom
legendecas:build-pie-linux

Conversation

@legendecas

Copy link
Copy Markdown
Member

Refs: #66951

In my testing on a linux RHEL 8 host, built with gcc (not clang as in our release toolchain), it shows no significant performance cost either on startup time, binary size, or runtime cpp heavy path:

non-PIE PIE
node -e 0 median, run 1 24.12 ms 25.72 ms (+1.60 ms, +6.6%)
node -e 0 median, run 2 23.64 ms 25.04 ms (+1.40 ms, +5.9%)
.rela.dyn 3.5 KB 2.65 MB
.data.rel.ro 97 KB 1.38 MB
.text 56.7 MB 57.7 MB (+1.7%)
file size (not stripped) 146.0 MB 149.0 MB (+2.1%)

and with benchmark/compare.js --runs 30 --set inLen=1024 --set chunkLen=256 --set CPUSET=3 string_decoder:

encoding PIE vs non-PIE
ascii −1.71% (*)
utf8 −0.39%
base64-utf8 +3.48% (***)
base64-ascii +3.29% (***)
utf16le +1.26%

with string_decoder/string-decoder-create.js as a control group, mostly JS object creation, n=25000000, it even seems faster with *** confidence:

encoding PIE vs non-PIE
ascii +4.85% (***)
utf8 +5.54% (***)
utf-8 +5.15% (***)
base64 +3.77% (***)
ucs2 +3.24% (***)
UTF-8 +3.02% (**)
AscII +3.08% (***)
UTF-16LE +5.22% (***)

Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run. labels Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants