Re: append() versus &=
- Posted by Lewis Townsend <keroltarr at HOTMAIL.COM> Sep 13, 2000
- 439 views
Hello Rob, Jiri I did try switching the parts arround and it did make a difference. But either way, append() was still slower on the "complex" append. >I think your benchmark is completely dominated by the troublesome rand() >function. Take it out of the loop and you will see Rob indeed optimised the >common case: > s1 = append(s1, s2) I used rand() to add some variation in the data because otherwise cacheing occurs which speeds up things in a seemingly unpredictable way. I can't think of any useful program (off the top of my head) that would simply append thousands of identical items to each other. Besides, I don't see how rand() was messing up the numbers since I always did the same thing in both loops. Perhaps an assignment and THEN the append would work better. I am currently working on 2 projects: LOOP (an OOP lib) and a real-time game. Both will need all the speed they can get and both will be operating on complex sequences with plenty of randomness. I felt that my benchmarks adequately tested for speed in this situation but perhaps not. I have tried testing LOOP lib itself with either all append()s or all &=s. Sometimes one seems faster and sometimes the other. I want to use the one that's faster MOST of the time but I think your (jiri's) program allows data caching to invalidate the benchmarks. I'm not sure WHAT was going on with mine that always gave the second loop an advantage but I'd like to know how to accurately test for the speed of random complex data appending. Jiri, I'm sure you can come up with something. I wouldn't just wait for you to do all the work but I wont' be able to do any coding until after this weekend as I'll be away from my comp for 4 days. later, Lewis Townsend _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.