falconre / falcon

Binary Analysis Framework in Rust
Apache License 2.0
549 stars 47 forks source link

il::Constant is slow with num_bigint #40

Closed endeav0r closed 4 years ago

endeav0r commented 6 years ago

The num_bigint crate is slow. Due to requirements in handling amd64 instructions, Falcon moved to a big integer library to support operands > 64 bits in width. This will also be required for SSE/AVX instructions in the future.

However, because il::Constant is now only backed by num_bigint::BigUint, this incurs unacceptable slowdowns during operations such as lifting entire binaries. il::Constant requires more sophisticated logic to back operations over faster u64-native operations when appropriate.

endeav0r commented 6 years ago

We were waiting for the num_bigint crate to hit 0.2 before releasing Falcon 0.3.1. This issue was created before 0.2 num_bigint.

It looks like perhaps the num_bigint crate made some performance changes, or the performance issues have gone away, with 0.2? There does not seem to be a noticeable difference between using u64-backed constants, and the BigUint values from the num_bigint crate. I'll continue to monitor, but I'm not sold the complexity of u64/BigUint-backed Constants outweighs the minor performance gains.