[Bf-committers] Performance Patch for Blender

Ton Roosendaal ton at blender.org
Tue Jul 19 10:29:35 CEST 2005


Hi,

OK, now I really checked it. :)
There's a confusing REMAKEIPO and REMAKEALLIPO event... the latter  
isn't window related, and should not even be called in the allspace()  
function.

Your patch solves the slowdown yes, but I rather fix this more proper.  
It is only called from the NLA, so I will move that code over there.

Thanks for finding the issue,

-Ton-

On 18 Jul, 2005, at 22:49, Ton Roosendaal wrote:

> Hi Thomas,
>
> Thanks for pointing to this issue. :)
> It indeed looks like a horrible piece of code... not sure what the  
> original intention was of it, most likely it was added quick to get  
> something work.
>
> As part of the animation-recode project, I was planning to re-assemble  
> the full action and nla editors as well. I'll keep your patch on my  
> checklist, but will do first work to get the big picture right.
>
> ALso note that the Ipo "space data" stores ipo-curve editing  
> information, something this piece of code probably tried to get  
> working... will review that as well.
>
> -Ton-
>
>
> On 18 Jul, 2005, at 16:28, Thomas H. Hendrick wrote:
>
>>
>> Hey.  Love the program, outstanding work, etc, etc.
>>
>> I'm new to the Blender code, but I was noticing serious slowdown
>> problems with 2.36, 2.37, and 2.37a when I was deleting an action  
>> strip
>> from an armature.  Using my profiler and some other tools, I think I  
>> may
>> have found something which will speed things up (if I understand this
>> section of code at all).
>>
>> Attached please find a small patchfile for one file
>> (source/blender/src/space.c).
>>
>> If I read the code correctly:
>>
>> for each Screen of G.main
>>    for each ScrArea of Screen.areabase
>>      for each SpaceLink of ScrArea.spacedata
>>        if event is REMAKEALLIPO
>>          for each ipo in G.main->ipo
>>            for each curve in ipo->curve
>>              testhandles_ipocurve
>>
>> However, as far as I know, IPO Data blocks are not related to Screens,
>> ScrAreas, or SpaceLinks.  So, each time you go through this process,
>> you're going to be recalculating the same IPO Data, and getting the  
>> same
>> result.  At least, I think so.
>>
>>
>>
>> --  
>> ---------------------------------------------------------------------- 
>> --
>> Tom Hendrick<thomas.hendrick at vistagy.com>                Technical  
>> Staff
>> [W] 1-(781)-290-0506 x252   [M] 1-(617) 448-2585    [H]  
>> 1-(978)-244-1149
>> Vistagy, Inc.                                     
>> http://www.vistagy.com/
>> Index: source/blender/src/space.c
>> ===================================================================
>> RCS file: /cvsroot/bf-blender/blender/source/blender/src/space.c,v
>> retrieving revision 1.266
>> diff -B -w -u -r1.266 space.c
>> --- source/blender/src/space.c	11 Jun 2005 16:30:36 -0000	1.266
>> +++ source/blender/src/space.c	8 Jul 2005 18:31:42 -0000
>> @@ -4780,27 +4780,32 @@
>>  {
>>  	bScreen *sc;
>>
>> -	sc= G.main->screen.first;
>> -	while(sc) {
>> -		ScrArea *sa= sc->areabase.first;
>> -		while(sa) {
>> -			SpaceLink *sl= sa->spacedata.first;
>> -			while(sl) {
>> -				switch(event) {
>> -				case REMAKEALLIPO:
>> -					{
>> +  /* -------------------------------------------------------
>> +   * Since IPOs are not relative or related to Screens, Screen  
>> Areas, or
>> +   * SpaceLinks, recalculating all of the IPOs for every screen,  
>> screen
>> +   * area, and space link is really unnecessary, isn't it?
>> +   * ------------------------------------------------------- */
>> +  if( REMAKEALLIPO == event ){
>>  						Ipo *ipo;
>>  						IpoCurve *icu;
>>  						
>>  						/* Go to each ipo */
>>  						for (ipo=G.main->ipo.first; ipo; ipo=ipo->id.next){
>> +      /* fprintf( stderr, "Beginning recalc of ipo : %s\n",  
>> ipo->id.name ); */
>>  							for (icu = ipo->curve.first; icu; icu=icu->next){
>>  								sort_time_ipocurve(icu);
>>  								testhandles_ipocurve(icu);
>>  							}
>>  						}
>>  					}
>> -					break;
>> +  else{
>> +    sc= G.main->screen.first;
>> +    while(sc) {
>> +      ScrArea *sa= sc->areabase.first;
>> +      while(sa) {
>> +        SpaceLink *sl= sa->spacedata.first;
>> +        while(sl) {
>> +          switch(event) {
>>  				case REMAKEIPO:
>>  					if(sl->spacetype==SPACE_IPO) {
>>  						SpaceIpo *si= (SpaceIpo *)sl;
>> @@ -4826,6 +4831,7 @@
>>  		}
>>  		sc= sc->id.next;
>>  	}
>> +  }
>>  }
>>
>>  /* if header==1, then draw header for curarea too. Excepption for  
>> headerprint()... */
>>
>> <thomas.hendrick.vcf>_______________________________________________
>> Bf-committers mailing list
>> Bf-committers at projects.blender.org
>> http://projects.blender.org/mailman/listinfo/bf-committers
>>
> ----------------------------------------------------------------------- 
> ---
> Ton Roosendaal  Blender Foundation ton at blender.org  
> http://www.blender.org
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list