(silly?) speed comparisons

Peter Otten __peter__ at web.de
Wed Jul 9 08:17:03 CEST 2008


mk wrote:

> Now C++ version took over twice the time to execute in comparison to
> Python time!

> Am I comparing apples to oranges? 

Indeed. Where in Python you're passing references your C++ code produces
copies of the vector. For starters you can change the function signature to

void move_slice(vector<string>& vec, int start, int stop, int dest)

which should already give your C++ implementation a significant speed boost.

Peter




More information about the Python-list mailing list