[Bf-committers] Re: [Bf-blender-cvs] CVS commit: blender/source/blender/python/api2_2x Mesh.h Mesh.c

Branan Riley branan at gmail.com
Fri Sep 22 16:42:04 CEST 2006


yeah, it would. But it'll actualy run slower, at least on an x86 chip.
A modern Pentium (or Core) is optimized for 32-bit numbers, then
16-bit, then 8-bit. An 8-bit number which exists solely in a function
will likely be added to the stack - which isn't aligned. This will
slow down all stack operations (which includes variable access, and
function calls - ouch). Not only that, arithmetic operations are
slower on 8-bit numbers. Just go with an int. The savings in memory
aren't worth the slowdown.

On 9/22/06, Campbell Barton <cbarton at metavr.com> wrote:
> Martin Poirier wrote:
> > --- Campbell Barton <cbarton at metavr.com> wrote:
> >
> >
> >> campbellbarton (Campbell Barton) 2006/09/22 12:08:41
> >> CEST
> >>
> >>   Modified files:
> >>     blender/source/blender/python/api2_2x Mesh.h
> >> Mesh.c
> >>
> >>   Log:
> >>   Mesh iterators (me.faces, me.edges, me.verts, face
> >> and edge iterator) store the iterator progress in
> >> the python object.
> >>   This made nested loops with the same python object
> >> mess up.
> >>   eg-
> >>   faces= me.faces
> >>   for f1 in faces:
> >>     for f2 in faces:
> >>       print f1.index,f2.index
> >>
> >>   This didnt work, fixed by initializing the iter
> >> value at -1, so any greater value will create a new
> >> BPyObject with its own iter value.
> >>   once iteration is finished, its set back to -1.
> >>
> >
> > You mean it creates one BPy Mesh wrapper per iterator?
> >
> > In that case, how do you invalidate iterators if the
> > mesh structure changes during the lifetime of the
> > iterator?
> >
> >
> >>   Also made face and edges iter value a char instead
> >> of an int to save some memory.
> >>
> >
> > Did you confirm that this did indeed reduce memory
> > usage? Memory alignement optimisation (or requirement)
> > would likely mess with it.
> >
> > Martin
> >
> Good point, I expected a char would just use less mem. even if its
> optimized out, wouldent that depend on the compiler, or even the
> compiler flags?
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list