[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: memory management
>This is simple optimization. Z-order, in the purest sense, is a list,
>from nearest to fartest. But raising a window would mean updating many
>pointers, moving the end of the list at the top, grafting what was the
>top at the end (meaning finding the end, which means walking the list
>for a simple singly linked list) and finally updating the pointer to the
>list in the parent window.
Premature optimisation...etc.
Is it really needed? Is the time taken to faff about with the linked list REALLY
significant? Compared with the effort of pushing the data for the windows that
have just been revealed about? Given how often a user raises a window? {It
doesn't happen every frame does it?}
All resulting in a data model that doesn't mirror reality and reference counting
issue?
>Instead, I just change the pointer in the parent window to the next
>window and everything is fine (except refcounting). MFC does it this way
>I think, Turbo Vision (eeks!) used to do it this way, and probably
>others.
These are of course EXCELLENT models to be taking as inspiration... something
written by a drunken horde of half-trained chimps in a blind panic and something
written in the days when adding integers was an expensive operation you
considered carefully before doing.
I know for a fact, the last two windowing systems I wrote didn't do that and I
had no performance issues.
I bet X11 doesn't do it that way either.
Might I suggest you get it working in a naive, but simple way? One often
discovers that that turns out to be best.