Re: [AD] new GUI focus selection algorithm

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> Well, I'm not. A more clever person once said "If you can avoid an
> optimization, then avoid it" :-)

I see what you mean, but I think you'd better know who is listening...

> Seriously, one multiplication per object and keypress is absolutely no
> problem, under no realistic circumstances. Especially not in code that
> unnecessarily calls qsort() when all it wants is to find the minimum
> distance (a simple linear search avoids function pointer calls and
> quadratic worst-time complexity).

Sorting the objects is necessary because you don't know in advance if they 
will accept the focus.

> And especially not when, for each keypress, you additionally have to redraw
> the objects that lost and gained focus, a much more costly operation...

Yes. But I think this kind of reasoning is responsible for the big slow-down 
GCC incurred between the 2.x and 3.x series: every developer wanted to add 
its own optimization pass (1-2% in compilation time on average), so I'm a 
bit wary of it now.

> If you can motivate your alternative algorithm in another way, that's
> fine, but I think speed is really irrelevant here (and Euclidean
> distance seems more intuitive, intuitively :-).

I think speed can never be irrelevant in the GUI domain. My reasoning is as 
follows: were our algorithm (nearly) perfect, I'd agree with you that we 
should use the "perfect" distance. Now our algorithm is only good enough, so 
I think a "good enough" distance is sufficient.

-- 
Eric Botcazou




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/