4/29/2007

Sieve of Eratosthenes - After thoughts

The most interesting part of this exercise was that each attempt performed better and better until I the DSL version. Even the objectisizing and then groovyizing resulted in better response times. Now perhaps I doing something silly in the DSL version because the extra method dispatch for the DSL keywords shouldn't slow it down 5 times.

It is clear that the need to use a DSL for this problem is irrational.

Here are the tests for the Sieve of Eratosthenes problems and the results

.Time: 488.8ms: Algorithm: Sieve1 Primes: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
.Time: 248.4ms: Algorithm: Sieve2 Primes: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
.Time: 270.4ms: Algorithm: Sieve3 Primes: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
.Time: 1145.6ms: Algorithm: Sieve5 Primes: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

No comments: