On Tuesday 24 October 2006 13:30, Hartmut Goebel wrote: > BTW: Using string-concationation is bad habbit, since it's slow. One > should prever fthe % operator.
That is a common myth. People should test things themselves instead of believing everything that is written on the net. Here are some test results that contradict the above statement in any scenario I tried. Results were obtained by repeating each of the string operations displayed below for 1000000 times on each test: time = 0.55 sec; rate = 1806698 requests/sec; s = 'foo ' + s2 time = 0.77 sec; rate = 1305975 requests/sec; s = 'foo %s' % s2 time = 0.69 sec; rate = 1440251 requests/sec; s = 'foo ' + s2 + ' bar' time = 0.73 sec; rate = 1375230 requests/sec; s = 'foo %s bar' % s2 time = 0.69 sec; rate = 1455167 requests/sec; s = 'foo ' + s2 + s3 time = 0.97 sec; rate = 1028526 requests/sec; s = 'foo %s %s' % (s2, s3) time = 1.00 sec; rate = 1000144 requests/sec; s = 'foo ' + s2 + s3 + s4 time = 1.15 sec; rate = 867080 requests/sec; s = 'foo %s %s %s' % (s2, s3, s4) As you can see string concatenation can be more than 30% faster than the % operator. The 3 string concatenation was even faster than the % operator with a single argument. -- Dan ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss