I've ran mutmut run once with the normal print_stats method and once with calculate_summary_stats(...) commented out. In my case (with ~2000 of untested mutants) this changed it from ~80s to ~70s total runtime.
I think usually this won't be noticeable, however when running only a subset of the tests (eg with tests_dir), it is normal to have many untested mutants. For this use case, this is a significant slowdown.
The status_printer method already has a check to print only every 0.1s. Maybe we could make it a class that exposes a would_print() -> bool method and then we only calculate the summary stats every 0.1s. Or we could pass it the summary stats creating function as argument, and the status_printer calls the method every 0.1s.
Maybe we could also make calculate_summary_stats more efficient, I didn't look into that.
I've ran
mutmut runonce with the normalprint_statsmethod and once withcalculate_summary_stats(...)commented out. In my case (with ~2000 of untested mutants) this changed it from ~80s to ~70s total runtime.I think usually this won't be noticeable, however when running only a subset of the tests (eg with tests_dir), it is normal to have many untested mutants. For this use case, this is a significant slowdown.
The
status_printermethod already has a check to print only every 0.1s. Maybe we could make it a class that exposes awould_print() -> boolmethod and then we only calculate the summary stats every 0.1s. Or we could pass it the summary stats creating function as argument, and the status_printer calls the method every 0.1s.Maybe we could also make
calculate_summary_statsmore efficient, I didn't look into that.