[Tutor] performance

Carlos Daniel Ruvalcaba Valenzuela clsdaniel at gmail.com
Mon Sep 17 08:48:35 CEST 2007


Don't worry too much for the accessors, I'm pretty sure it won't
degrade your performance in a noticeable way, you objects will only
grow a tiny bit by adding a function to the class, all objects share
the same in memory code and each one has it's own data, the function
for the object is just a reference for the class function, not the
memory of the function itself (I think, it would be a waste of memory
otherwise).

However take it with a grain of salt, do your own benchmarks, you
could do a simple measure with time.time() function, or use one of the
several profiling modules for python (profile, hotshot, etc).

Forwarded to Tutor list, I forgot it sorry!

Regards,
Carlos Daniel Ruvalcaba Valenzuela

On 9/16/07, Jeff Peery <jeffpeery at yahoo.com> wrote:
> Hello,
> I've got a quick question regarding performance of lists. I am taking
> measurements and building up a list of objects for each measurement. the
> class I created for the objects has attributes of time, numerical value,
> person's name who collected the sample etc. I also have functions within my
> class (I think they are properly named 'accessors'?) that get a piece of
> data within the object, for example 'self.GetSampleTime()'. I'm wondering
> what happens to my performance as I add more accesors to my class. How are
> the accesors managed? will each object in my list of objects contain the
> data for each accesor or do all the objects look to the sample module for
> the accesor? will my list of objects become huge and slow as I add more
> accessors? thanks.
>
> Jeff
>
>  ________________________________
> Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos.
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>


More information about the Tutor mailing list