flat assembler
Message board for the users of flat assembler.

Index > Windows > SetProp/GetProp vs SetWindowLong/GetWindowLong

Author
Thread Post new topic Reply to topic
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 04 Sep 2004, 09:06
Hi.
Related to my work on Fresh libraries, I made some
benchmarks of SetProp/GetProp functions compared with
GetWindowLong/SetWindowLong as two alternative methods
of handling subclassing and other user information in
windows instances.
The results are interesting, demonstrating (at least for
the test machine), that SetProp/GetProp can be faster than
SetWindowLong/GetWindowLong in some conditions and only
little slower in other. As far as using SetProp/GetProp
is more easy/convenient than Get/SetWindowLong, I think
they should be more widely used in assembly programs.

What you think about this point?

Test conditions:
Celeron 350MHz CPU
192Mbytes RAM
Every function was invoked 100000 times and timed
using GetTickCount with several different names of
the property (for SetProp/GetProp) Also SetProp/GetProp
was tested with passing string pointer as property
identifier and and also with passing ATOM, created
from the property name.

Quote:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100000 x SetProp, [hMainForm], propTest, edi
-- ----------------------------------------------
'Test' = 430ms (4.3us per call)
'TestProp' = 637ms (6.37us per call)
'TestPropTestProp' = 1046ms ( 10us per call )

VIA ATOM:
'TestProp' = 130ms ( 1.3us per call )
'TestPropTestProp' = 130ms ( 1.3us per call )

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

100000 x GetProp, [hMainForm], propTest
------------------------------------------------
'Test' = 400ms (4us per call)
'TestProp' = 600ms (6us per call)
'TestPropTestProp' = 970ms ( 9.7us per call )

VIA ATOM:
'TestProp' = 110ms ( 1.1us per call )
'TestPropTestProp' = 110ms ( 1.1us per call )

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

100000 x GetWindowLong, [hMainForm], GWL_USERDATA
------------------------------------------------
200ms (2us per call)

100000 x SetWindowLong, [hMainForm], GWL_USERDATA
------------------------------------------------
202ms (2.02us per call)


Last edited by JohnFound on 04 Sep 2004, 13:10; edited 1 time in total
Post 04 Sep 2004, 09:06
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 04 Sep 2004, 12:27
192mhz ram?
Post 04 Sep 2004, 12:27
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 04 Sep 2004, 13:11
roticv wrote:
192mhz ram?


Of course 192Mbytes. Simply mistake. Fixed. Smile
Post 04 Sep 2004, 13:11
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Foamplast



Joined: 07 May 2004
Posts: 36
Location: Saratov, Russia
Foamplast 04 Sep 2004, 21:54
Why do you compare such different things? GetWindowLong/SetWindowLong operate on data linked to the window and owned by Window's GUI. SetProp/GetProp/RemoveProp operate on user-defined data linked to the window. Generally, user-defined data can be read or written and GetProp/SetProp/RemoveProp functions can operate on these data without any understanding what these data are. Unlikely, GetWindowLong/SetWindowLong should have an understanding of the data's meaning to operate correctly. Your results show that this point of view can be true.
Post 04 Sep 2004, 21:54
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 04 Sep 2004, 22:40
Foamplast wrote:
Why do you compare such different things?


Both, Set/GetProp and Set/GetWindowLong can be used as placeholders for user data for subclassed windows, custom window classes and other user data asociated with some control ( GWL_USERDATA and also the extra bytes (WNDCLASS.cbWndExtra) defined for given user registered class)

So, usual method used in assembly written applications (you can check several examples here and there) is using Get/SetWindowLong, but my tests make me think that better method is namely SetProp/GetProp method. Besides that Get/SetProp is more flexible method, it seems that is is faster in some conditions and acceptable slower in worst case.

Of course my tests concerns only Win98. Maybe in Win2000/XP things looks different. (but I don't think so...)

Regards.
Post 04 Sep 2004, 22:40
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.