def fwscan_wins(limit, rlen, numdocs):
    """
    Primitive curve-fitting to see if forward scan will beat both
    nbest and timsort for a particular limit/rlen/numdocs tuple.  In
    sortbench tests up to 'numdocs' sizes of 65536, this curve fit had
    a 95%+ accuracy rate, except when 'numdocs' is < 64, then its
    lowest accuracy percentage was 83%.  Thus, it could still use some
    work, but accuracy at very small index sizes is not terribly
    important for the author.
    """
    docratio = rlen / float(numdocs)
    if limit:
        limitratio = limit / float(numdocs)
    else:
        limitratio = 1
    div = 65536.0
    if docratio >= 16384 / div:
        return True
    if docratio >= 256 / div:
        if 512 / div <= docratio < 1024 / div and limitratio <= 4 / div:
            return True
        elif 1024 / div <= docratio < 2048 / div and limitratio <= 32 / div:
            return True
        elif 2048 / div <= docratio < 4096 / div and limitratio <= 128 / div:
            return True
        elif 4096 / div <= docratio < 8192 / div and limitratio <= 512 / div:
            return True
        elif 8192 / div <= docratio < 16384 / div and limitratio <= 4096 / div:
            return True
    return False
