Skip to content

riscv_dis_opts_cache_support

Tsukasa OI edited this page Jul 21, 2022 · 19 revisions

Disassembler: Cache instruction class support

Requires

Aggregate performance benchmark should be available here.

  1. Disassembler: Use faster hash table
  2. Disassembler: Minor optimizations (batch 1)
  3. (You are here) Disassembler: Cache instruction class support

Feature Description

As I mentioned in the previous patchset, calling riscv_subset_supports repeatedly harms the performance in a measurable way (about 3-13% in total).

As a simple solution, this patch now caches instruction class support as a signed char array.

Performance Improvements

On disassembling linked RISC-V ELF files using objdump, performance improvements achieved by this patchset is about 5-6%. Not bad for a simple change.

This is relative to the previous optimization.

objdump -d (ELF)

Program Improvements Notes
Busybox 1.35.1 (RV64GC) 5.5-6.2%
OpenSBI 1.1 (generic fw_*.elf) 6.1-6.5%
Linux kernel 5.18 (vmlinux) 5.1-5.6%
Linux kernel 5.18 (vmlinux.o) 0.1-1.9% Not finally linked
glibc (libc.so.6) 5.1-5.7%

objdump -d (ELF-based archive)

Program Improvements
glibc (libc.a) 0.9-1.0%
newlib (libc.a) 1.1-1.9%

objdump -D (binary)

Program Improvements
Linux kernel 5.18 (vmlinux) 6.5-7.0%
Random files (/dev/urandom) 7.0-7.5%
1M (1048576) CSR instructions 38.4%

gdb: disas of near all code region

Program Improvements
Linux kernel 5.18 (vmlinux) with debug info -1.7%
Linux kernel 5.18 (vmlinux) without debug info -1.5%
OpenSBI 1.1 (generic fw_*.elf) (-0.8)-(-0.5)%
1M (1048576) CSR instructions (ELF) 5.1%

Batch: objdump -d on Linux distribution

Serial Run: All /usr/bin Programs

System N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) 563 5.0%
Debian unstable (as of 2022-07-20) 269 4.9%

Parallel Run: Top 100 in Size (including data-only ELFs)

System N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) 100 2.5%
Debian unstable (as of 2022-07-20) 100 0.7%

Parallel Run: All (including data-only ELFs)

System N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) 7666 2.3%
Debian unstable (as of 2022-07-20) 946 0.5%
Clone this wiki locally