Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Falcon 0.9.4
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
btiffin




PostPosted: Sat Aug 15, 2009 8:44 am   Post subject: 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
code:

sorted = Set().comp( ["oranges", "apples", "peaches", "bananas", "grapes" ] )
for item in sorted: > item


And the little engine is still pretty snappy...
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:prime]
         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:BATCH]
       sieve()
    end
    cycles += BATCH
//end
t = seconds() - t

f = Format( ".3" )
> f.format( t ), " seconds."
> count, " sieves."
> f.format(count / t), " sieves per second"

Results on an old P4 machine
code:

1.544 seconds.
809200 sieves.
523979.534 sieves per second

Cheers

Edit; fixed some bbcode
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: