|
Revision 362, 308 bytes
(checked in by JarrettBillingsley, 3 months ago)
|
Fixed a bug where array data was being allocated but not initialized, causing some GC cycles to try to scan garbage data (and crash). Updated the benchmarks and all that I've tested have worked fine, not to mention being at least 15% faster in most cases :)
|
| Line | |
|---|
| 1 |
module benchmark.sumfile; |
|---|
| 2 |
|
|---|
| 3 |
// ummm I don't know how to get the input file for this. |
|---|
| 4 |
function main() |
|---|
| 5 |
{ |
|---|
| 6 |
local timer = time.Timer.clone() |
|---|
| 7 |
timer.start() |
|---|
| 8 |
|
|---|
| 9 |
local sum = 0 |
|---|
| 10 |
|
|---|
| 11 |
foreach(line; io.stdin) |
|---|
| 12 |
sum += toInt(line) |
|---|
| 13 |
|
|---|
| 14 |
writeln(sum) |
|---|
| 15 |
|
|---|
| 16 |
timer.stop() |
|---|
| 17 |
writefln("Took {} sec", timer.seconds()) |
|---|
| 18 |
} |
|---|