I am trying to analyse the performance of Chapel while doing serial I/O by reading a file with varying number of lines and measuring the time taken. I then plot this time on a graph. I find that each time the program is run, the time taken to read the file containing the same number of lines vary every time.
These are the graphs

This is the graph obtained across two executions. For each execution, I vary the number of lines in the file from 10 to 50000 in steps of 50. The files that I have used
use Time;
config const quiet: bool = false;
var myfile=open("/home/sayanc/Cpp_programs/t2.txt",iomode.r);
var myreadingChannel=myfile.reader(locking=false);//reading channel with locking
disabled
var x:string;
var count:int=0;
//timer variable
var t:Timer;
t.start();
for line in myfile.lines()
{
count=count+1;
}
t.stop();
// this is the file where the time is being stored.
var fout = open("/home/sayanc/Cpp_programs/chapel_locking_vs_nolocking_file_reading
time.txt", iomode.rw);
// Position a writing channel at the end of the file
var cout = fout.openAppender();
cout.writeln("Without Locking:",t.elapsed());
cout.close();
fout.close();
myreadingChannel.close();
myfile.close();
//reading the same file this time with locking enabled
myfile=open("/home/sayanc/Cpp_programs/t2.txt",iomode.r);
//locking enabled
myreadingChannel=myfile.reader();
count=0;
var t1:Timer;
t1.start();
for line in myfile.lines()
{
count=count+1;
}
t1.stop();
//writeln(count);
fout = open("/home/sayanc/Cpp_programs/chapel_locking_vs_nolocking_file_reading
time.txt", iomode.rw);
// Position a writing channel at the end of the file
cout = fout.openAppender();
cout.writeln("With locking:",t1.elapsed());
cout.close();
fout.close();
myreadingChannel.close();
myfile.close();
/* Create a writer channel with a starting offset at the end of the file */
proc file.openAppender() {
var writer = this.writer(start=this.size);
return writer;
This is the chapel code for reading the file.The graph shown above is obtained using locking=false option.
I use a C++ program to write the lines in the file.
So, I would like to know why is it that reading the same number of lines takes different times across different executions? }
