|
2020-07-15
| ||
| 20:07 | • Closed ticket [3c6e47363e]: Performance degradation by compiled "lappend&qu... artifact: 37847fa22f user: sebres | |
| 20:06 | closes [3c6e47363e]: missing de-duplication mechanism for nested TEBC starting from scratch (e. g. n... check-in: 1947d9b440 user: sebres tags: core-8-6-branch | |
| 19:17 | • Ticket [3c6e47363e] Performance degradation by compiled "lappend" comm... artifact: 81dc5de8eb user: sebres | |
| 17:50 | • Ticket [3c6e47363e]: 3 changes artifact: 068475c326 user: sebres | |
| 17:50 | • New ticket [3c6e47363e]. artifact: c473beecdb user: sebres | |
Performance degradation by compiled "lappend" command (compared to 8.5)
But it is not correct for 8.6, see:
proc test_fifo {l} { timerate {
set l [linsert $l [set l 0] x]; set l [lreplace $l [set l 0] 0]
} }
proc test_lilo {l} { timerate {
lappend l x; set l [lreplace $l [set l end] end]
} }
set c 1000
while {$c <= 1e6} {
puts "** $c **"
puts fifo:\t[test_fifo [lrepeat $c a]]
puts lilo:\t[test_lilo [lrepeat $c a]]
set c [expr {$c * 10}]
}
# Results:
# ----------------------------------
# Tcl 8.5:
# ----------------------------------
** 1000 **
fifo: 0.815292 µs/# 1189045 # 1226554 #/sec 969.419 net-ms
lilo: 0.319608 µs/# 2895810 # 3128836 #/sec 925.523 net-ms
** 10000 **
fifo: 4.296829 µs/# 231345 # 232729 #/sec 994.050 net-ms
lilo: 0.316483 µs/# 2922252 # 3159727 #/sec 924.843 net-ms
** 100000 **
fifo: 44.1857 µs/# 22619 # 22631.7 #/sec 999.437 net-ms
lilo: 0.316588 µs/# 2921358 # 3158682 #/sec 924.866 net-ms
** 1000000 **
fifo: 519.944 µs/# 1924 # 1923.3 #/sec 1000.373 net-ms
lilo: 0.317124 µs/# 2916790 # 3153344 #/sec 924.983 net-ms
# ----------------------------------
# Tcl 8.6:
# ----------------------------------
** 1000 **
fifo: 0.704807 µs/# 1338218 # 1418827 #/sec 943.186 net-ms
lilo: 3.795696 µs/# 260543 # 263456 #/sec 988.942 net-ms
** 10000 **
fifo: 4.236343 µs/# 233711 # 236052 #/sec 990.080 net-ms
lilo: 35.7963 µs/# 27903 # 27935.9 #/sec 998.823 net-ms
** 100000 **
fifo: 43.6455 µs/# 22890 # 22911.9 #/sec 999.046 net-ms
lilo: 570.914 µs/# 1752 # 1751.6 #/sec 1000.241 net-ms
** 1000000 **
fifo: 507.387 µs/# 1971 # 1970.9 #/sec 1000.059 net-ms
lilo: 5640.94 µs/# 178 # 177.28 #/sec 1004.088 net-ms
It affecting the lappend command, because replacing of lappend l ... with set l [linsert $l [set l end] x] solves the issue...
Also it affects only compiled version, because replace of "timerate" with "time" solving the issue too.
In-between I found and fixed it (checking other corner cases) and will push my ultimate fix soon.
1947d9b440closes [3c6e47363e]: missing de-duplication mechanism for nested TEBC starting from scratch (e. g. nested compiled blocks enclosed in parent cycle), so reset interp's result to avoid possible duplications of large objects by first commands like lappend, append, etc check-in2020-07-15 20:06:07
No - there are too many corner cases.
Something is inefficient by de-duplication handling in TEBCresume (initially provided for [781585], [804681]). But rather it is wrong somewhere, because I see refCount growing every first time it enter test_lilo (where it should remain unchanged), so it could also leak at some point (must check).
WiP.
Should be fixed now in [1947d9b440].