Artifacts Associated With Ticket 3c6e47363e
Ticket change [c473beecdb] (rid 184755) by sebres on 2020-07-15 17:50:03:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
Today I considered totally weird behavior testing some code (initially written for 8.5) in 8.6... Since I know the inner architecture of tcl-lists, I always thought that better is organize FIFO as LILO (because insert/removal of 0th element is very expensive operation on large lists), so showed also the practice all the time. But it is not correct for 8.6, see: <pre><code> 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}] } </code></pre> <pre><code> # 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 </code></pre> It affecting the lappend command, because replacing of <code>lappend l ...</code> with <code>set l [linsert $l [set l end] x]</code> 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. - foundin initialized to: ">= 8.6"
- is_private initialized to: "0"
- login: "sebres"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Severe"
- status initialized to: "Open"
- submitter initialized to: "sebres"
- subsystem initialized to: "47. Bytecode Compiler"
- title initialized to:
Performance degradation by compiled "lappend" command (compared to 8.5)
- type initialized to: "Bug"
Ticket change [068475c326] (rid 184756) by sebres on 2020-07-15 17:50:17:
- assignee changed to: "sebres"
- login: "sebres"
- mimetype: "text/plain"
Ticket change [81dc5de8eb] (rid 184762) by sebres on 2020-07-15 19:17:40:
- icomment:
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.
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [37847fa22f] (rid 184767) by sebres on 2020-07-15 20:07:25:
- closedate changed to: "2459046.33849041"
- closer changed to: "sebres"
- icomment: "Should be fixed now in [1947d9b440]."
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"