Monday, May 01, 2006

text reading speed benchmark.

there are three functions which can read text data file:

textread

load

dlmread

Below I make a comparison among their reading speed. It turns out that textread is an obvious winner.

--------------------------------

tic
s8=textread('fget1.txt','%f');
toc

tic
s9=load('fget1.txt');
toc

tic
s7=dlmread('fget1.txt');
toc

--------------------------

fget1.txt contains one dimentional array data with 1261050 lines.

Time consumed for each function:

textread: Elapsed time is 5.437752 seconds.
load: Elapsed time is 10.676539 seconds.
dlmread: Elapsed time is 12.076604 seconds.

No comments: