Open ejrgilbert opened 1 month ago
Some docs on the flame graph.
> cargo install --locked samply
> samply record whamm instr --script tests/scripts
/fault_injection/dfinity/dfinity_async_strcmp_fn.mm --app tests/apps/dfinity/users.wasm
94% of the time is spent on the two regex functions in
define_compiler_var
. My guess is the bad time complexity of doing regex matches for the entire wasm file (since it's worst-case exponential as I recall people doing DoS attacks with regex matching).
I'm guessing that it's running slowly with the behavior tree because of having to clone the probe each time it processes a new instruction, try seeing if it's possible to remove the clone, or at least, just clone the predicate.