Skip to content

exex: performance optimizations#6

Merged
rabarbra merged 11 commits into
mainfrom
performance
Jul 1, 2026
Merged

exex: performance optimizations#6
rabarbra merged 11 commits into
mainfrom
performance

Conversation

@rabarbra

Copy link
Copy Markdown
Member

No description provided.

rabarbra added 7 commits June 30, 2026 12:29
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
rabarbra added 4 commits June 30, 2026 21:19
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
Signed-off-by: Polina Simonenko <rabarbrablad@gmail.com>
@rabarbra rabarbra marked this pull request as ready for review July 1, 2026 06:00
Copilot AI review requested due to automatic review settings July 1, 2026 06:00
@rabarbra rabarbra merged commit 1755e66 into main Jul 1, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on reducing CPU, allocation, and UI-latency costs across both the CLI dump paths and the TUI by introducing lighter-weight “layout-only” loads, more streaming/early-exit behavior, and better async job cancellation/ignore-stale-result handling.

Changes:

  • Add “layout-only” binary loading and use it for CLI output views that don’t need full symbol/reloc/DWARF parsing (plus perfreport measurement refinements).
  • Improve TUI responsiveness via cooperative cancellation, caching, and stale-result guards for async scans (search/xref/syscalls/cpufeatures/demangle).
  • Optimize dump/scanning hot paths (strings streaming, syscall/CPU-feature scans, symbol lookup iteration) and add/extend targeted tests/benchmarks.

Reviewed changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/perfreport/main.go Refines per-stage perf measurement to use per-run prepared files and clarifies cold vs warm measurements.
main.go Adds layout-only open option for CLI -o views that can use it.
internal/ui/xref.go Adds xref caching, cancellation, and stale-file guards for async xref scans.
internal/ui/view_symbols.go Defers/guards symbol list construction and avoids lowercasing work when filter is empty.
internal/ui/view_relocs.go Fixes relocs view to use its own filter model (not libs filter) throughout.
internal/ui/view_disasm.go Invalidates/aborts derived async disasm jobs when disasm image state changes.
internal/ui/update.go Tightens async message handling (file identity checks), adjusts prewarm behavior, refreshes modal symbol names on demangle changes.
internal/ui/syscalls.go Adds cancellation, caching, stale-file guards, and cancel behavior for syscall scans (incl. full scope).
internal/ui/search.go Adds explicit disasm search cancellation channel teardown.
internal/ui/search_disasm.go Adds cancellation + stale-file checks to disasm search, plus faster ASCII-folded matching path.
internal/ui/render_bench_test.go Adds benchmark for Relocs view rendering.
internal/ui/newviews_test.go Extends relocs/libs filter regression coverage.
internal/ui/new.go Initializes a dedicated reloc filter and defers initial symbol recompute.
internal/ui/model.go Adds symbols “ready” state, relocsState struct, and search cancel channel storage.
internal/ui/key_dispatch.go Adds Esc handling to cancel full syscall scan; uses reloc-specific filter capture.
internal/ui/goto.go Avoids sorting/allocation by using bounded ranked buckets for symbol matches.
internal/ui/goto_test.go Adds tests for goto ranking/cap behavior.
internal/ui/disasm_decode.go Tags async disasm decode results with file identity for stale-result ignores.
internal/ui/cpufeatures.go Adds cancellation + caching for CPU feature scan modal and stale-file guards.
internal/ui/chrome.go Ensures symbols are prepared when switching into Symbols mode.
internal/ui/async_test.go Adds tests ensuring stale async messages are ignored and cancellation behaves correctly.
internal/explorer/navigation.go Refines default exec address selection using section properties (exec + file bytes).
internal/explorer/disasm_service.go Switches to RangeFunc-style decoding to reduce work and early-stop cleanly.
internal/dump/syscalls.go Adds cancelable full syscall collection and refines chunk scanning boundaries/cancellation.
internal/dump/syscalls_test.go Adds coverage for x86 localized syscall scanning and chunk-boundary behavior.
internal/dump/perf_bench_test.go Improves bench timing and adds CPU-features benchmark; uses layout-only where appropriate.
internal/dump/dump.go Adds ViewNeedsLayoutOnly, improves Disasm symbol labeling via range iterator, and rewrites Strings output to stream/avoid copies.
internal/dump/cpufeatures.go Adds cancelable CPU feature scanning and faster ARM64/x86 decode paths using x/arch decoders.
internal/dump/cpufeatures_test.go Adds tests verifying raw-decode classification matches existing text-based classifier behavior.
internal/disasm/decoder.go Avoids full Unicode lowercasing in common mnemonic paths; reduces allocations in immediate formatting when unchanged.
internal/cpufeat/cpufeat.go Uses ASCII-only lowering fast-path for mnemonic extraction.
internal/binfile/symsort.go Simplifies symbol sort to true in-place sort to reduce memory pressure.
internal/binfile/symbols_test.go Adds tests for SymbolAt alias preference and range iterator parity.
internal/binfile/strings.go Adds streaming string scan API with bounded memory and parallel chunk scan with ordered emit.
internal/binfile/strings_test.go Adds ScanStrings tests (ordering, no-cache, closed-pipe behavior).
internal/binfile/reloc.go Makes HasRelocs cheaper when availability is known; clears builder after first build; adds format-level “has relocs” helpers.
internal/binfile/reloc_test.go Adds tests for reloc availability short-circuiting and Mach-O reloc symbol-name retention.
internal/binfile/pe.go Adds layout-only early return; defers DWARF/reloc builds with availability checks.
internal/binfile/parse_bench_test.go Closes files in open benchmark and adds layout-only open benchmark.
internal/binfile/model.go Adds layoutOnly flag, refactors symByAddr to index-based structure + prefix max ends, adds source-files-only DWARF path, and range iterator.
internal/binfile/macho.go Adds layout-only Mach-O parser, fat-header-lite parsing, reloc availability + lazy build, and relocatable synthetic address handling.
internal/binfile/macho_test.go Adds tests for layout-only equivalence, synthetic section addrs for objects, and fat-slice bounds checks.
internal/binfile/loader.go Introduces WithLayoutOnly option and skips heavy finalization/overview when enabled.
internal/binfile/image.go Makes HasExecCode cheap via section scan instead of building exec image.
internal/binfile/elf.go Moves segment/LMA parse earlier and adds DWARF/reloc availability + lazy build support; supports layout-only early return.
docs/ROADMAP.md Marks roadmap items complete.
docs/hyper.sh Parameterizes exex binary path for benchmarking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/dump/dump.go
Comment on lines +449 to +459
return f.ScanStrings(func(e binfile.StringEntry) error {
line = appendStringLinePrefix(line[:0], e, addrW)
if _, err := bw.Write(line); err != nil {
return nil
return io.ErrClosedPipe
}
if _, err := bw.Write(f.StringBytes(e)); err != nil {
return nil
return io.ErrClosedPipe
}
if err := bw.WriteByte('\n'); err != nil {
return nil
return io.ErrClosedPipe
}
Comment thread docs/ROADMAP.md
Comment on lines +466 to 468
## 31. Extract pathes

Extract all the pathes from strings
@rabarbra rabarbra deleted the performance branch July 14, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants