GrammaTech / ddisasm

A fast and accurate disassembler
https://grammatech.github.io/ddisasm/
GNU Affero General Public License v3.0
645 stars 60 forks source link

Disassemble becomes slower with more cores. #39

Closed 5c4lar closed 2 years ago

5c4lar commented 2 years ago

I tried to disassemble a big binary file. Just outputting the assembly took me more than half an hour on a single core; when I wanted to disassemble it with a debug-dir, even with 96 cores, it runs more than two hours and seems not going to stop very soon. What is the right way to get the function boundaries? Is it slow because of the debug-dir option or the multi-thread setting? image

5c4lar commented 2 years ago

Well, it stopped at about 2h10, strange...

aeflores commented 2 years ago

Ddisasm's parallelism takes advantage of the parallel data structures defined by souffle. In our experience, the performance of using a few cores tends to be higher than a single core, but if you increase the core count too much, you will get the opposite effect. This is probably due to increasing synchronization overhead. In other words, you might get the best performance by using 4-8 cores.

The debug-dir option is unlikely to have such a big effect in the analysis time, the disassembly time will be the same, but some extra time will be spent writing the input facts (before disassembly) and the inferred relations (after disassembly) to disk. This is usually a very small percentage of the analysis time.

5c4lar commented 2 years ago

Thanks for your detailed explanation.