| Ticket UUID: | 1675258 | ||
| Title: | mem alloc performance on Linux | ||
| Type: | Bug | Created on: | 2007-03-06 20:47:45 |
| Submitter: | dgp | Assigned to: | msofer |
| Subsystem: | 41. Memory Allocation | Severity: | |
| Priority: | 6 | Last modified: | 2009-05-01 08:25:13 |
| Status: | Open | Closed by: | |
| Resolution: | None | Closed on: | |
| Version: | None | ||
| Description: | ||||
Some tclbench benchmarks suggest loss of [lappend] performance in Tcl 8.5. Normalized form: 000 VERSIONS: 1:8.5a6 2:8.4.15 3:8.3.5 010 LIST concat EVAL/LAPPEND 2x10 2.34 1.00 0.93 011 LIST concat EVAL/LAPPEND 2x100 2.80 1.00 0.87 012 LIST concat EVAL/LAPPEND 2x1000 3.66 1.00 0.78 013 LIST concat EVAL/LAPPEND 2x10000 1.61 1.00 0.80 014 LIST concat FOREACH/LAPPEND 2x10 2.47 1.00 2.06 015 LIST concat FOREACH/LAPPEND 2x100 2.45 1.00 3.02 016 LIST concat FOREACH/LAPPEND 2x1000 2.64 1.00 3.17 017 LIST concat FOREACH/LAPPEND 2x10000 2.39 1.00 3.12 Original numbers: 010 LIST concat EVAL/LAPPEND 2x10 10.12 4.32 4.00 011 LIST concat EVAL/LAPPEND 2x100 19.43 6.93 6.00 012 LIST concat EVAL/LAPPEND 2x1000 107.59 29.39 23.00 013 LIST concat EVAL/LAPPEND 2x10000 620.62 386.44 311.00 014 LIST concat FOREACH/LAPPEND 2x10 10.79 4.37 9.00 015 LIST concat FOREACH/LAPPEND 2x100 55.14 22.49 68.00 016 LIST concat FOREACH/LAPPEND 2x1000 540.40 204.56 649.00 017 LIST concat FOREACH/LAPPEND 2x10000 4992.72 2088.81 6508.00 These slowdowns are not seen on Solaris. | ||||
| User Comments: | ||||
nobody added on 2007-03-07 04:09:01:
Logged In: NO tclguyperhaps it's a LE vs. BE opt issue? dgp added on 2007-03-07 23:06:16:
Logged In: YES user_id=80530 Originator: YES another strange data point... I see this slowdown only when I run the tcl/list.bench file alone. When I test the entire tclbench benchmark suite, and then look at these tests, these large performance losses are not seen. dgp added on 2007-03-07 23:13:12:
Logged In: YES user_id=80530 Originator: YES ok, when running the whole tclbench suite, it is the ARRAY benchmarks that are slow. I'm guessing that it's the first tests that allocate significant memory that see the slowdown, and it's memory allocation that has actually lost performance. dgp added on 2007-03-22 03:53:50:
Logged In: YES
user_id=80530
Originator: YES
There seems to be a common thread
in these benchmarks of
for .... {
lappend l ....
}
Have we somehow lost the efficiency
of our growth algorithm? Is it
related to the new List intrep?
dgp added on 2007-03-22 03:58:23:
Logged In: YES user_id=80530 Originator: YES I see that [lappend] is now implemented via a call to Tcl_ListObjReplace() while it used to be done via direct intrep surgery. msofer added on 2007-03-22 04:40:29:
Logged In: YES
user_id=148712
Originator: NO
EVAL/LAPPEND performance might be due to the Tcl_ListObjReplace scenic tour, but FOREACH/LAPPEND not: the lappend bcc implementation did not change and does not go through T_LOR: it goes through Tcl_ListObjAppendElement (via TclPtrSetVar) just like in 8.4. I do not immediately see that T_LOAE could have gotten slower because of the new list intrep.
(Sidenote: EVAL/LAPPEND is not idiomatic for 8.5: one would use {*} instead of [eval]. A new benchmark EXPAND/LAPPEND might be useful).
msofer added on 2007-03-22 05:25:04:
Logged In: YES user_id=148712 Originator: NO There seems to be a problem where the first interp to run pays some kind of penalty. Benchmarking two copies of the same executable I get huge diffs! mig@ice:/home/CVS/tclbench$ ./runbench.tcl -verbose -paths /home/CVS/tcl-core-8-4-branch/unix/ tcl/array.bench TCL_INTERP: 1:8.4.15 2:8.4.15 STARTED 2007-03-21 19:22:49 (runbench.tcl v1.20) Benchmark 1:8.4.15 /home/CVS/tcl-core-8-4-branch/unix/tclsh a 00:00:03 elapsed 3161 milliseconds Benchmark 2:8.4.15 /home/CVS/tcl-core-8-4-branch/unix/tclsh1 a 00:00:03 elapsed 2520 milliseconds 000 VERSIONS: 1:8.4.15 2:8.4.15 001 ARRAY genKeys 50 1391.59 1153.22 002 ARRAY genKeys 500 2880.64 1418.72 003 ARRAY makeHash 500 50 57144.28 47765.00 003 BENCHMARKS 1:8.4.15 2:8.4.15 FINISHED 2007-03-21 19:22:55 msofer added on 2007-03-22 06:04:40:
Logged In: YES user_id=148712 Originator: NO More data points: seems to really be a linux issue? * http://paste.tclers.tk/180 shows 8.5a6 under linux (with strange timings, consistent accross reruns, same thing for tclkit) * http://paste.tclers.tk/178 (tclkitsh) and http://paste.tclers.tk/179 (tclsh) show that there is no such weirdness under WinXP. dgp added on 2007-03-22 22:51:24:
Logged In: YES user_id=80530 Originator: YES I confirm that on Linux <REDACTED> 2.6.19-1.2911.6.5.fc6 #1 SMP <DATE> i686 athlon i386 GNU/Linux the first identical copy runs slower than the second. dgp added on 2007-11-28 01:02:18:
Logged In: YES user_id=80530 Originator: YES did we ever puzzle this out? is it still true on the HEAD? hobbs added on 2007-11-28 01:25:32:
Logged In: YES user_id=72656 Originator: NO It seems true for FOREACH/LAPPEND still, but not as severe as the original report. | ||||
