Re: Win32lib additions [3]

new topic     » goto parent     » topic index » view thread      » older message » newer message

>----- Original Message -----
>From: <euman at bellsouth.net>
>To: "EUforum" <EUforum at topica.com>
>Subject: Re: Win32lib additions [3]
>

>
>I dont understand Derek,

You're not the first to say that they don't understand me blink

>I'll just continue to make the change to Win32lib on my own and for
>those who want to gain a bit of speed set window_handle as global

That's your call and that's okay by me.

Win32lib has never be designed for those people who need as much speed as
possible. If you need a faster way to code windows programs then don't use
win32lib, or adapt a version for your own purposes.

Win32lib is designed to be quick at CREATING and MAINTAINING Windows
programs. Execution speed is not its highest priority. Its is designed to
make Windows programming easier by doing a lot of the housekeeping. In order
to do that, it generalizes a LOT of code - and that does not make for
optimal speed.

I know you know this stuff already but I'll say it again anyway, for the
benefit of our listening audience blink

Generally speaking, there is always a trade-off between execution speed and
functionality. There is lots of functionality inbuilt into this library at
the cost of execution speed. And that seems to suit a lot of people, by the
way.


>so you can use the [internal] Win32lib sequence like this:
>
>ListLV = create(ListView, "",hWnd, x1, y1,x2, y2, flags)
>hListLV = window_handle[ListLV]
>--later when messages are needed to be sent
>VOID = w32Func( xSendMessage, {hListLV, etc..etc
>
>instead of having to process hundreds of lines in Win32lib trying to send
>a simple message.

"hundreds"? Are you joking? How about this instead...

 ListLV = create(ListView, "",hWnd, x1, y1,x2, y2, flags)
 hListLV = getHWND(ListLV)
 --later when messages are needed to be sent
 VOID = w32Func( xSendMessage, {hListLV, etc..etc

If you look at the getHWND function it turns out to be "return
window_handle[ListLV]", hardly a lot of overhead there.

In fact, the w32Func call has *way* more overhead and I guess you'll be
calling that heaps more times than the getHWND call.

If you really are running on a slow machine, you would be better to code it
in 'raw' Euphoria or even Masm32 instead.

>Im not saying you arent right Derek about good programming practice but
>when speed counts and it does, why not use something Win32lib [internally]
>uses on a regular basis.

Whether it takes 10 milliseconds or 100 milliseconds to get a control's
handle is not going to worry most people. Sure speed counts, but getting
speed costs. Count the cost, and make a trade-off that suits your purposes.

Many studies have shown that the best way to speed up an application is to
improve the algorithms, rather than optimise the code. You can spend far
more time in creating and maintaining optimised code than the time it saves
during execution.

>Are you saying we arent smart enough to use this sequence?

Of course not! I'm trying to make life easier for us all. For example, if
window_handle is made global, an accidental bug can write stuff into that
variable and cause problems that could be very hard to track down.

Another issue is that if I decide to change the internal use of this field,
or do away with it altogether, then your program and any others that DEPEND
on window_handle will break. This is a real concern. For example, there are
a whole heap of internal fields associated with each instantiated control.
Currently these are each in their own sequence. Someday in the future I
might change this in to a different structure due to performance reasons (or
some other valid reason). But if I made this or similar internal fields
global, I'd always be worried about breaking people's programs.

That is why I publish global routines. Their interface to user's code does
not change. So if your code uses getHWND(id) and I do change the internal
structures, this routine will still work as advertised.

>never mind, just on a soapbox...

Soapboxes are good - so long as one can hear their audience from up there.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu