
-----------------------------------
btiffin
Sat Aug 15, 2009 8:44 am

Falcon 0.9.4
-----------------------------------
A new Falcon release has been posted.  http://www.falconpl.org/index.ftd?page_id=official_download

Nice.  Fixes to the interactive mode now make it a much more friendly learning and exploration environment.

One of the new additions is list comprehensions
sieve.fal one of the benchmarks shipped with the source tarball
[code]
 /*
   FALCON - Benchmarks

   FILE: sieve.fal

   Timed Sieve of Eratosthenes.
   
   Measures performance how many computational loops are performed
   in  a given amount of time.
   
   See also "sieve_mt.fal"
   -------------------------------------------------------------------
   Author: Giancarlo Niccolai
   Begin:

   -------------------------------------------------------------------
   (C) Copyright 2008: the FALCON developers (see list in AUTHORS file)

   See LICENSE file for licensing details.
*/

// Config

const SIZE = 8092
const BATCH = 100
const TIME = 30
flags = arrayBuffer( SIZE+1 )

//=========================
// The sieve
//=========================

function sieve()
   global count

   flags.fill(0)
   for i in [1:SIZE+1]
      if flags[i]: continue
            
      prime = 2 * i + 1
      start = prime + i
      for k in [start:SIZE+1]
         flags[k] = 1
      end
   end
   count += i
end

//=========================
// Main code
//=========================

count = 0
cycles = 0
t = seconds()
//while seconds() < t + TIME   // Test for TIME (30) seconds
    for iter in [0]
       sieve()
    end
    cycles += BATCH
//end
t = seconds() - t

f = Format( ".3" )
> f.format( t ), " seconds."
> count, " sieves."
> f.format(count / t), " sieves per second"
[/code]
Results on an old P4 machine
[code]
1.544 seconds.
809200 sieves.
523979.534 sieves per second
[/code]
Cheers

Edit; fixed some bbcode
