[Edu-sig] How to Improve code performance
Titu Kim
kimtitu@yahoo.com
Tue, 30 Oct 2001 11:27:40 -0800 (PST)
I am also looking for the result on this question.
--- Seth David Schoen <schoen@loyalty.org> wrote:
> Seth David Schoen writes:
>
> > If all you do with tab is print it out, you don't
> need to do all
> > of those string operations, or function calls:
> >
> > print "Content-type: text/html"
> > print "<table align='center' border='1'>"
> > for x in result:
> > print "<tr>"
> > for item in x:
> > print "<td>"+str(item)+"</td>"
> > print "</tr>"
> > print "</table>"
> >
> > Printing output right away would have lower
> overhead and use less
> > memory.
>
> This can be a big deal for efficiency in a very high
> level language.
> Building large or complex data structures could have
> very high
> overhead; for example, dynamic allocation of space
> for strings can be
> a real problem if you do it over and over again
> hundreds of thousands
> of times!
>
> Anyway, this also has me wondering about the
> relative speed of
> different Python iteration idioms (for, while, map,
> recursion, and now
> list comprehensions). They're not all applicable to
> the same
> problems, but where there is overlap, which are
> faster than others?
>
> --
> Seth David Schoen <schoen@loyalty.org> | Its really
> terrible when FBI arrested
> Temp. http://www.loyalty.org/~schoen/ | hacker, who
> visited USA with peacefull
> down: http://www.loyalty.org/ (CAF) | mission --
> to share his knowledge with
> http://www.freesklyarov.org/ | american
> nation. (Ilya V. Vasilyev)
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig@python.org
> http://mail.python.org/mailman/listinfo/edu-sig
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com