in reply to file comparisons: - making it faster

$new_guy:

A couple observations:

  1. You're reading a file inside a loop, so you can potentially read and discard it a large number of times. Perhaps it would be better to store the data and simply reuse it?
  2. You've got some nested loops: the number of times you execute the code in the innermost loop is typically the product of the number of iterations of each loop. So you need to:

Of course, this is assuming that you've run the appropriate profiling tools and determined that the nested loops are your problem. (Don't optimize what isn't a problem.)

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: file comparisons: - making it faster