Skip to content

riscv_dis_opts_cache_support

Tsukasa OI edited this page Aug 31, 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 programs using objdump, performance improvements achieved by this patchset is about 5-7%. Not bad for a simple change.

This is relative to the previous optimization.

objdump -d (ELF)

Program Improvements Notes
Busybox 1.35.1 (RV64GC) 6.3-7.1%
OpenSBI 1.1 (generic fw_*.elf) 7.4-8.0%
Linux kernel 5.18 (vmlinux) 6.1-6.4%
Linux kernel 5.18 (vmlinux.o) 0.3-2.5% Not finally linked
glibc (libc.so.6) 6.4-7.0%

objdump -d (ELF-based archive)

Program Improvements
glibc (libc.a) 0.6-1.0%
newlib (libc.a) 1.2-1.9%

objdump -D (binary)

Program Improvements
Linux kernel 5.18 (vmlinux) 8.6-8.8%
Random files (/dev/urandom) 8.5-9.0%
1M (1048576) CSR instructions 37.4%

gdb: disas of near all code region

Program Improvements
Linux kernel 5.18 (vmlinux) with debug info 1.0%
Linux kernel 5.18 (vmlinux) without debug info 1.7%
OpenSBI 1.1 (generic fw_*.elf) 1.5-1.6%
1M (1048576) CSR instructions (ELF) 8.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 6.3%
Debian unstable (as of 2022-07-20) 269 5.9%

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

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

Parallel Run: All (including data-only ELFs)

System N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) 7666 2.9%
Debian unstable (as of 2022-07-20) 946 0.9%

Batch: objdump -D (as binary) on Linux distribution

Serial Run: All /usr/bin Programs

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

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

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

Parallel Run: All (including data-only ELFs)

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