MarcelGarus / factorize

A simple real-time prime factorization program for the command line. Also supports imports as a python library with generators for primes and prime factors.
1 stars 1 forks source link

less prints for better performance in output mode #2

Closed felixrindt closed 5 years ago

felixrindt commented 5 years ago

Printing is a costly operation. This introduces a mechanism so that we don't output as often. This leads to some performance improvement.


$ time python factorize.py 2595925957847039                        
2595925957847039
= 38047
* 140281
* 486377
python factorize.py 2595925957847039  5.73s user 0.01s system 99% cpu 5.742 total
$ git checkout master
Switched to branch 'master'
$ time python factorize.py 2595925957847039
2595925957847039
= 38047
* 140281
* 486377
python factorize.py 2595925957847039  6.19s user 0.04s system 99% cpu 6.257 total```