<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/71b955d332b50b6ffbddf2d27762bb57b123ba6e">https://github.com/macports/macports-base/commit/71b955d332b50b6ffbddf2d27762bb57b123ba6e</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 71b955d332b50b6ffbddf2d27762bb57b123ba6e
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Fri Dec 2 16:25:50 2016 +1100
<span style='display:block; white-space:pre;color:#404040;'> Don't use ldindex to implement lpop and lshift
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Instead just use lrange and lindex. This is twice as fast.
</span>---
src/macports1.0/macports_util.tcl | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/macports_util.tcl b/src/macports1.0/macports_util.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 04e0996..bc74176 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/macports_util.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/macports_util.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -148,11 +148,9 @@ proc ldindex {varName args} {
</span> # If varName is an empty list an empty string is returned
proc lpop {varName} {
upvar 1 $varName var
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set size [llength $var]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$size != 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return [ldindex var end]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set element [lindex $var end]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set var [lrange $var 0 end-1]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $element
</span> }
# lpush varName ?value ...?
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -169,11 +167,9 @@ proc lpush {varName args} {
</span> # If varName is an empty list an empty string is returned
proc lshift {varName} {
upvar 1 $varName var
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set size [llength $var]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$size != 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return [ldindex var 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set element [lindex $var 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set var [lrange $var 1 end]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $element
</span> }
# lunshift varName ?value ...?
</pre><pre style='margin:0'>
</pre>