Re: thoughts on meta-data
Wari Wahab <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
> 11:20 AM /d/code/Python/testfiles$ python test_meta.py
> test took 0.205000 seconds
>
> So there's not really a lot of difference that I see.
Because you created the files and read them on the spot, you'll see no
difference. Mine is:
Vertigo:~/Documents/Work/tests wari$ python testmeta.py
test took 0.207048 seconds
If you edit the test_meta to not run make_files(), and wait ten
seconds, you'll see that the time it takes to read the generated files
can increase by a factor of two:
Vertigo:~/Documents/Work/tests wari$ python testmeta.py
test took 0.405119 seconds
If I tried to optimise test() even further by:
def test():
i = 0
totaltime = 0.
t1 = time.time()
while i < 1000:
fname = 'test' + str(i)
test_meta(fname)
i += 1
t2 = time.time()
totaltime = t2-t1
print "test took %f seconds" % totaltime
I still get about:
Vertigo:~/Documents/Work/tests wari$ python testmeta.py
test took 0.301428 seconds
Anyway, depending on the test platform, results may vary. I believe
that a system using a drive with 8 MB cache can perform better, for
example, or if the data buffers is just full of recent drive access.
Anyway, if I change the test_meta(fname) to os.stat(fname) to compare
times for a simple call I got:
Vertigo:~/Documents/Work/tests wari$ python testmeta.py
test took 0.042642 seconds
Now, that is what I call a huge difference, not to mention you open the
file twice, once to read the metadata, and once to parse the data.
Anyway, final mention that NONE of these tests will reflect on real
world pyblosxom usage, which is mostly co-hosted with everyone else.
Test on that and results can skew further IMO.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click