Pages

Mar 15, 2015

[Python] Performance enhance by not using range() for comparison

When I was trying to enhance the performance of my Python code, the frist thing I tried is reducing the usage of functions. After I substituted the range() function, the performance had improved a lot, from 404ms to 106ms. The following is the difference between the two versions of the "ZigZag Conversion" code.

404ms
106ms Although the performance result depends on the test data, this substitution really improves the entire performance.

No comments:

Post a Comment