DMelt:IO/Performance
From HandWiki
Member
I/O performance
The classes HFile and PFile have similar performance. The output files for scientific data are compressed in both cases. PFile typically generate files by 10-20% smaller the serialization using HFile.
Let us write 100 vectors with 10000 random numbers using HFile and PFile and note the time of the execution:
from jhplot import * from jhplot.io import * import time Max=10000 start = time.clock() f1=HFile("test.ser","w") for i in range(100): p=P0D("test") p.randomUniform(Max,0,10) f1.write(p) f1.close() print 'HFile write=',time.clock()-start start = time.clock() f1=PFile("test.pbu","w") for i in range(100): p=P0D("test") p.randomUniform(Max,0,10) f1.write(p) f1.close() print 'PFile write=',time.clock()-start
The output is:
HFile write= 3.1675735 PFile write= 1.703302514
You can see that PFile class a factor 2 faster in write mode. The PFile file is 10-20% smaller.
from jhplot import * from jhplot.io import * import time tart = time.clock() f1=HFile("test.ser") for i in range(100): p=f1.read() if p == None: break f1.close() print 'HFile read=',time.clock()-start start = time.clock() f1=PFile("test.pbu") for i in range(100): p=f1.read() if p == None: break f1.close() print 'PFile read=',time.clock()-start
The output is:
HFile read= 0.918767501 PFile read= 0.591144485
As you can see, the PFile class is faster by 30-40% for the read operation.