exex: performance optimizations#6
Merged
Merged
Conversation
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>
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>
There was a problem hiding this comment.
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 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 on lines
+466
to
468
| ## ✅ 31. Extract pathes | ||
|
|
||
| Extract all the pathes from strings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.