Kurosu a écrit :
> Matthieu Fertré a écrit :
>   
>> So, in my opinion, the detection of duplicated rectangles must be done 
>> in Map::OptimizeCache(). Methods Map::ToRedrawOnScreen() and 
>> Map::ToRedrawOnMap() should stay silly methods.
>>     
>
> I think that on the other hand, as long as Map::ToRedrawOnWhatever is 
> not in a time-critical path, it should do the job: that's the best spot 
> to optimize. Let me show you my train of thought about this.
>
> Prerequisite:
> Have something to actually benchmark what is faster (I have my own idea 
> about this).
>
> Steps:
> - Following Kyle's notice, having duplicates is not such a big problem: 
> (a) contains (a), so (a) can probably be removed during the occlusion test
> - Is sorting the list then performing occlusion the fastest, ie is 
> sorting really needed?
>   

No but if you don't sort, you have to iterate over all the items. I 
suppose that the efficiency depends on the size of the lists.

> - If that is faster, then isn't it faster although to have an 
> automatically sorted list by adding each element at its correctly 
> ordered location; you have a smaller set to work on
>   

Well probably right, and in that case, you can remote it directly at 
insertion if it's a useless rectangle.

Anyway, OptimizeCache is perhaps totally useless, do we really gain 
something with it ? I'm not sure there's so many duplicates (but it is 
true that the SDL blit function costs a lot!)

Regards,

Matt (gentildemon)

_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à