mirror of https://github.com/pwndbg/pwndbg.git
Optimize the vis_heap_chunks by creating VALID_CHARS once
This commit optimizes the `bin_ascii` function used by the `vis_heap_chunks` command.
That function executed the following line on each call:
```
valid_chars = list(map(ord, set(printable) - set("\t\r\n\x0c\x0b")))
```
And it could be called thousand times, e.g. 90k on a benchmark.
This commit moves the creation of the `valid_chars` list to the global space so it is computed only once.
As a result, on a simple benchmark we improved the speed of `vis_heap_chunks` command from 4.6s to 3s.
pull/1710/head
parent
e77c6f5c2e
commit
f402732a33
Loading…
Reference in new issue