Add autoskip option to hexdump and dumpstruct#158
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #158 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 21 21
Lines 2470 2482 +12
=====================================
- Misses 2470 2482 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 19.46%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_benchmark_basic[compiled] |
81.2 µs | 73.3 µs | +10.7% |
| ⚡ | test_benchmark_getattr_typedefs |
27.5 µs | 24.3 µs | +12.97% |
| ⚡ | test_benchmark_getattr_types |
27 µs | 23.8 µs | +13.68% |
| ⚡ | test_benchmark_getattr_constants |
17 µs | 13.5 µs | +26.28% |
| ⚡ | test_benchmark_attribute_access |
15.3 µs | 11.3 µs | +35.53% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing hexdump-autoskip (aae286d) with main (29652dd)
|
@codspeedbot explain why this is faster |
Also it's not very clear in the man page, but it always leaves the first NUL(L) line intact. |
Probably, yes. But that has bigger changes with #156. Perhaps we can do that in that PR. |
roger |
This PR adds a
autoskipargument to thehexdump()anddumpstruct()functions. Whenautoskip=Trueit will collapse all consecutive NULL bytes on a hexdump line to a single*. This mimics the--autoskipfeature ofxxd:and with dissect hexdump
autoskip=True:Note that I have also changed the
hexdump()function signature to be kwargs only starting from the second argument. I think this is much cleaner and less error prone. I'm doubting if we should do the same fordumpstruct().