/**
 * @author milthorpe
 */
public class BenchmarkForEach extends Benchmark {
    val N: int;

    def expected() = 0.0;
    def operations() {
        return N as double;
    }

    public def this(N: int) {
        this.N = N;
    } 

    def once() {
        val a = Array.make[Double](Dist.makeBlock([0..N-1], 0), ((i) : Point) => i as Double);
        finish foreach ((i) in a) {
            a(i) += 2.0;
        }
        return 0.0;
    }

    public static def main(args:Rail[String]!) {
        if (args.length >= 1) 
            new BenchmarkForEach(Int.parseInt(args(0))).execute();
        else 
            new BenchmarkForEach(1000000).execute();
    }
}

