1. Re: Optimization (was Edom 2.02)
- Posted by Falkon <Falkn13 at IBM.NET> Jun 23, 1998
- 520 views
Oops! redo from start From: me >So I did an experiment, with the following output: Okay, as you may have guessed, I pasted the output from the wrong experiment, and drew the wrong conclusions. This was the append test: Time for 10 thousand iterations of append Expression: Time in seconds ---------- seq1 = append( seq1, 3 ): 0.010000 seq1[3] = append( seq1[3], 3 ): 3.440053 seq1[seq2[3]] = append( seq1[seq2[3]], 3 ): 3.380052 seq1[seq2[3]] = append( seq1[seq2[3]], seq2[3] ): 3.370052 seq1[3][3] = append( seq1[3][3], 3 ): 3.370052 seq1[seq2[3]][3] = append( seq1[seq2[3]][3], 3 ): 3.390052 seq1[seq2[3]][seq2[3]] = append( seq1[seq2[3]][seq2[3]], 3 ): 3.430053 temp = append( temp, 3 ) (same as last one above, but using temp): 3.410052 temp = append( temp, 3 ) (same as last one, but with temp set outside loop): 0.010000 ------------------- New conclusion: It only takes 0.000001 second for a straight atomic append. That's pretty darn fast, I think. But even one level of subscription takes about 340 times as long. The complexity of the subscription doesn't seem to matter much after that. And using a temp variable doesn't help if it's inside the loop because of the subscription time on the assignment, (the other experiment). But if it's outside the loop, it works a minor miracle.