PAGE2GO2 HOME | INTERNET NEWS

LeighExchange - Free Advertising Network Stock Research at Internet Speed Need Money Easy and Quick?

Re: Python object overhead?

 List
Subject: Re: Python object overhead?
Poster: MarkNenadovmark@freelance-developer.com
Date: Fri, 23 Mar 2007 19:31:17 -0400
Related Postings: 1 2 3 4 5 6 7
On Fri, 23 Mar 2007 19:11:23 -0300, Gabriel Genellina wrote:


> Poor xreadlines method had a short life: it was born on Python 2.1 and got
> deprecated on 2.3 :(
> A file is now its own line iterator:
>
> f = open(...)
> for line in f:
> ...

Gabriel,

Thanks for pointing that out! I had completely forgotten about that!

I've tested them before. readlines() is very slow. The deprecated xreadlines() is close in speed to open() as an iterator. In my particular test, I found the following:

readlines() -> 32 "time units" xreadlines() -> 0.7 "time units" open() iterator -> 0.41 "time units"

-- Mark Nenadov -> skype: marknenadov, web: http://www.marknenadov.com -> "They need not trust me right away simply because the British say that I am O.K.; but they are so ridiculous. Microphones everywhere and planted so obviously. Why, if I bend over to smell a bowl of flowers, I scratch my nose on a microphone." -- Tricyle (Dushko Popov) on American Intelligence

 

Page2Go2.com is not responsible for content of this message.