S
SherjilOzair
Hello list,
When it comes to printing things while some computation is being done, there are 2 extremes.
1. printing speed is slower than data-to-print generation speed. In this case, printing is a bottleneck. Examples: "for i in xrange(2**30): print i". Without the print, this code would be much faster.
2. data-to-print generation speed is slower than printing speed. So, this case, printing does now slow you down much. Example: for m in matrices: print m.inverse() # inverse is a time-taking function
These two cases are pretty easy. But, my question is, how to draw the line? How do I know that print is slowing me down, and I should probably remove some of them? Is there a scientific way to do this, rather than just intuition and guesswork?
I can clarify, if needed.
Thanks,
Sherjil Ozair
When it comes to printing things while some computation is being done, there are 2 extremes.
1. printing speed is slower than data-to-print generation speed. In this case, printing is a bottleneck. Examples: "for i in xrange(2**30): print i". Without the print, this code would be much faster.
2. data-to-print generation speed is slower than printing speed. So, this case, printing does now slow you down much. Example: for m in matrices: print m.inverse() # inverse is a time-taking function
These two cases are pretty easy. But, my question is, how to draw the line? How do I know that print is slowing me down, and I should probably remove some of them? Is there a scientific way to do this, rather than just intuition and guesswork?
I can clarify, if needed.
Thanks,
Sherjil Ozair