binary-search: use nth-unsafe for a further performance gain

db4
Slava Pestov 2010-04-18 14:24:17 -05:00
parent eb3c6f414b
commit cf69c58eee
1 changed files with 2 additions and 2 deletions

View 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