diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-11-15 06:12:58 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-11-15 06:12:58 -0800 |
commit | 6f7c75ed060f3c824740cf0a471be4a235f2fe51 (patch) | |
tree | 0f4fbcdf306d85668b2152fcbe998471b95059f2 | |
parent | b19f145f88e9fd62c8d6e99cb8470563c9997234 (diff) | |
download | txr-6f7c75ed060f3c824740cf0a471be4a235f2fe51.tar.gz txr-6f7c75ed060f3c824740cf0a471be4a235f2fe51.tar.bz2 txr-6f7c75ed060f3c824740cf0a471be4a235f2fe51.zip |
find-max: tiny optimization for vectors.
* lib.c (find_max): The vector case must loop from
index one, not zero, so as not to wastefully compare the
initial max element to itself.
-rw-r--r-- | lib.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -8572,7 +8572,7 @@ val find_max(val seq, val testfun, val keyfun) val len = length(vec); val i; - for (i = zero; lt(i, len); i = succ(i)) { + for (i = one; lt(i, len); i = succ(i)) { val elt = ref(vec, i); val key = funcall1(keyfun, elt); if (funcall2(testfun, key, maxkey)) { |