|
From: Tatulea, D. <dra...@in...> - 2012-06-27 06:22:08
|
Hi, I am proposing a Memcheck optimization for marking code ranges/maps as trusted to do lighter instrumentation on those ranges. The idea & feedback came from James Seward and Philippe Waroquiers. When instrumenting trusted code, Memcheck would: * always load a const for LOAD's * use a lighter STORE op which always writes V bits. * avoid doing V-bit computations. This is achieved during JIT optimization, when the above mentioned const LOAD's will be constant folded, and V-bit removed as dead code (since the const's are never written anywhere). Patches can be found in [BZ301269]. To get some some data, I ran perf with all code marked as trusted. This is the maximum theoretical improvement. Practically this is not achievable because someone would want to run Valgrind with at least one untrusted lib. These are the results: -- Running tests in perf ---------------------------------------------- -- bigcode1 -- bigcode1 valgrind-none-trusted:0.10s me: 2.7s (27.1x, -----) bigcode1 valgrind-all-trusted:0.10s me: 2.0s (20.1x, 25.8%) -- bigcode2 -- bigcode2 valgrind-none-trusted:0.10s me: 6.9s (69.2x, -----) bigcode2 valgrind-all-trusted:0.10s me: 5.4s (53.6x, 22.5%) -- bz2 -- bz2 valgrind-none-trusted:0.52s me: 7.6s (14.7x, -----) bz2 valgrind-all-trusted:0.52s me: 3.2s ( 6.2x, 58.1%) -- fbench -- fbench valgrind-none-trusted:0.22s me: 3.9s (17.9x, -----) fbench valgrind-all-trusted:0.22s me: 1.8s ( 8.0x, 55.3%) -- ffbench -- ffbench valgrind-none-trusted:0.20s me: 2.8s (13.9x, -----) ffbench valgrind-all-trusted:0.20s me: 1.2s ( 5.8x, 58.3%) -- heap -- heap valgrind-none-trusted:0.07s me: 4.8s (69.0x, -----) heap valgrind-all-trusted:0.07s me: 4.4s (62.9x, 8.9%) -- heap_pdb4 -- heap_pdb4 valgrind-none-trusted:0.08s me: 7.4s (92.0x, -----) heap_pdb4 valgrind-all-trusted:0.08s me: 4.7s (58.1x, 36.8%) -- many-loss-records -- many-loss-records valgrind-none-trusted:0.01s me: 1.2s (118.0x, -----) many-loss-records valgrind-all-trusted:0.01s me: 1.1s (107.0x, 9.3%) -- many-xpts -- many-xpts valgrind-none-trusted:0.03s me: 1.7s (56.7x, -----) many-xpts valgrind-all-trusted:0.03s me: 1.4s (48.0x, 15.3%) -- sarp -- sarp valgrind-none-trusted:0.02s me: 1.9s (97.0x, -----) sarp valgrind-all-trusted:0.02s me: 1.7s (86.5x, 10.8%) -- tinycc -- tinycc valgrind-none-trusted:0.15s me: 8.4s (56.3x, -----) tinycc valgrind-all-trusted:0.15s me: 5.5s (36.5x, 35.1%) -- Finished tests in perf ---------------------------------------------- == 11 programs, 22 timings ================= [BZ301269] - https://bugs.kde.org/show_bug.cgi?id=301269 Thanks, Dragos Tatulea |