]> gitweb.factorcode.org Git - factor.git/commitdiff
binary-search: use nth-unsafe for a further performance gain
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 18 Apr 2010 19:24:17 +0000 (14:24 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 19 Apr 2010 02:42:44 +0000 (21:42 -0500)
basis/binary-search/binary-search.factor

index 36e983a1c8c1af71c9b00ed8f2c419f9aa6c9ab8..db40408d5e9235ccf2ecda44459e8cb60c6dbd75 100644 (file)
@@ -1,14 +1,14 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays combinators hints kernel locals math
-math.order sequences ;
+math.order sequences sequences.private ;
 IN: binary-search
 
 <PRIVATE
 
 :: (search) ( seq from to quot: ( elt -- <=> ) -- i elt )
     from to + 2/ :> midpoint@
-    midpoint@ seq nth :> midpoint
+    midpoint@ seq nth-unsafe :> midpoint
 
     to from - 1 <= [
         midpoint@ midpoint