|
|
Message-Id: <DH8NWLZ0CYDQ.3Q8NXEDW68ENA@tum.de> Date: Sat, 21 Mar 2026 19:12:44 +0100 From: "Fabian Rast" <fabian.rast@....de> To: "Rich Felker" <dalias@...c.org> Cc: <musl@...ts.openwall.com> Subject: Re: [PATCH] ldso: skip repeated symbol lookups for sorted relocations On Fri Mar 20, 2026 at 9:03 PM CET, Rich Felker wrote: > Always clearing prev_sym_index before and after the above code if type > is REL_COPY or REL_PLT seems like it would be safer and more obviously > correct. There should never be repeats of either of these types anyway > so we wouldn't be throwing anything away in terms of performance. I agree that the type==REL_PLT input should not be ignored. I also fixed a problem with the previous patch, where I missed to reset the prev_sym_index in the sym_idx==0 else case. This could have led to incorrect behavior for non-sorted relocation tables. Performance measurements for binaries distributed by alpine linux below: (Measured on AMD Ryzen AI 9 365, no turbo boost, core 0). = notcurses-input cycles:u: 44578781 (1.68) -> patch 42312050 (1.66) -5.08% instructions:u: 66690824 ( 0.0) -> patch 57174593 ( 0.0) -14.27% ref-cycles:u: 44669536 (1.67) -> patch 42371384 (1.64) -5.14% duration_time: 27649665 (2.05) -> patch 26486067 (2.03) -4.21% = mpv cycles:u: 154948683 (0.54) -> patch 133027348 (0.85) -14.15% instructions:u: 243158254 ( 0.0) -> patch 169533094 ( 0.0) -30.28% ref-cycles:u: 155345824 (0.53) -> patch 133261300 (0.88) -14.22% duration_time: 86473742 (0.75) -> patch 75395243 (1.07) -12.81% = ffmpeg cycles:u: 49045821 (1.61) -> patch 44659800 (1.64) -8.94% instructions:u: 73180082 ( 0.0) -> patch 59359875 ( 0.0) -18.89% ref-cycles:u: 49152380 ( 1.6) -> patch 44776624 (1.62) -8.9% duration_time: 29744448 ( 1.9) -> patch 27554582 (1.96) -7.36% = wireshark cycles:u: 147992758 (0.85) -> patch 130110894 (0.87) -12.08% instructions:u: 243223703 ( 0.0) -> patch 164207661 ( 0.0) -32.49% ref-cycles:u: 148304012 (0.82) -> patch 130422420 (0.87) -12.06% duration_time: 95765012 (1.08) -> patch 86819237 (1.05) -9.34% = wget cycles:u: 1304937 (6.47) -> patch 1304565 (6.54) -0.03% instructions:u: 1574246 ( 0.0) -> patch 1574142 ( 0.0) -0.01% ref-cycles:u: 1306592 (6.45) -> patch 1306452 (6.52) -0.01% duration_time: 1380021 (6.06) -> patch 1387685 (5.83) 0.56% = gsx cycles:u: 31159711 (1.77) -> patch 29604962 (2.02) -4.99% instructions:u: 44243591 ( 0.0) -> patch 39548053 ( 0.0) -10.61% ref-cycles:u: 31209044 (1.78) -> patch 29669404 (2.01) -4.93% duration_time: 20438772 (2.13) -> patch 19513270 (2.19) -4.53% = clang cycles:u: 23343809 (3.71) -> patch 19145813 ( 4.5) -17.98% instructions:u: 52355131 ( 0.0) -> patch 34797593 ( 0.0) -33.54% ref-cycles:u: 23391928 (3.69) -> patch 19164928 ( 4.5) -18.07% duration_time: 14451332 (3.61) -> patch 12283480 (4.16) -15.0% = office cycles:u: 125422509 (0.69) -> patch 93945649 (1.39) -25.1% instructions:u: 246846567 ( 0.0) -> patch 125227557 ( 0.0) -49.27% ref-cycles:u: 125740388 (0.69) -> patch 94184692 (1.38) -25.1% duration_time: 70947007 (0.84) -> patch 54847438 (1.54) -22.69% = libxul cycles:u: 41312364 (1.42) -> patch 39176318 (1.38) -5.17% instructions:u: 57565839 ( 0.0) -> patch 50706775 ( 0.0) -11.92% ref-cycles:u: 41420972 (1.41) -> patch 39257932 (1.37) -5.22% duration_time: 26737312 (1.78) -> patch 25480287 (1.64) -4.7% = webkit2gtk cycles:u: 169907241 (0.95) -> patch 130302217 (0.67) -23.31% instructions:u: 305958495 ( 0.0) -> patch 168061293 ( 0.0) -45.07% ref-cycles:u: 170315728 (0.94) -> patch 130613716 (0.67) -23.31% duration_time: 94967529 (1.06) -> patch 75018344 (0.79) -21.01% Cheers, Fabian View attachment "v2-0001-ldso-skip-repeated-symbol-lookups-for-sorted-relo.patch" of type "text/x-patch" (2148 bytes) Download attachment "signature.asc" of type "application/pgp-signature" (294 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.