From 46ca7ee46a1cf2b45f8f9105ef39ab2dbb57016c Mon Sep 17 00:00:00 2001 From: Vincent Snijders Date: Mon, 7 Jan 2008 13:51:34 +0000 Subject: [PATCH] o improved sumcol benchmark * read line in string and convert to integer using val, like gcc does * cache input text file, to avoid calling fpc_get_input all the time. git-svn-id: trunk@9671 - --- tests/bench/shootout/src/sumcol.pp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/bench/shootout/src/sumcol.pp b/tests/bench/shootout/src/sumcol.pp index acbf32391c..fbe6e59d86 100644 --- a/tests/bench/shootout/src/sumcol.pp +++ b/tests/bench/shootout/src/sumcol.pp @@ -4,20 +4,27 @@ contributed by Ales Katona modified by Daniel Mantione modified by Steve Fisher + modified by Vincent Snijders } {$iochecks off} var num, tot: longint; + s: string[128]; textbuf: array[0..8191] of char; + infile: ^text; begin - settextbuf(input, textbuf); + infile := @input; + settextbuf(infile^, textbuf); + tot := 0; repeat - readLn( num ); - tot += num - until eof; + readLn(infile^, s); + val(s, num); + tot := tot + num + until eof(infile^); writeLn(tot) end. +