Performance of event handling

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Performance of event handling

Thomas Singer
Hello experts,

Are there already some researches regarding the performance of event
handling in SWT for non-trivial applications? From time to time I need
to debug our application through code of SWT event handling and
depending on the control there are quite a large number of listeners and
for each event it steps through all the listeners. Wouldn't it be more
efficient if adding a listener would sort them by their event type, so
the loop knows when it can abort earlier? Wouldn't it be better, to
ensure to have just 1 (instead of multiple) listeners of the same type,
so the array of all listeners could be binary searched?

--
Best regards,
Thomas Singer
=============
syntevo GmbH
http://www.syntevo.com
http://www.syntevo.com/blog
_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
Reply | Threaded
Open this post in threaded view
|

Re: Performance of event handling

Leo Ufimtsev-2
Hey ya,

I'm not aware of event-based performance tests being done in the last ~3 years or so. The eventTable code looks pretty old.
Sorting the event table upfront might indeed improve performance somewhat, but it might also increase code clutter.

I would be happy to review a patch if there is an accompanying snippet that shows improvement in performance across platforms.

Thank you

Leo


On Tue, Jul 18, 2017 at 3:36 AM, Thomas Singer <[hidden email]> wrote:
Hello experts,

Are there already some researches regarding the performance of event handling in SWT for non-trivial applications? From time to time I need to debug our application through code of SWT event handling and depending on the control there are quite a large number of listeners and for each event it steps through all the listeners. Wouldn't it be more efficient if adding a listener would sort them by their event type, so the loop knows when it can abort earlier? Wouldn't it be better, to ensure to have just 1 (instead of multiple) listeners of the same type, so the array of all listeners could be binary searched?

--
Best regards,
Thomas Singer
=============
syntevo GmbH
http://www.syntevo.com
http://www.syntevo.com/blog
_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev



--

Leo Ufimtsev

Software Engineer

Red Hat


90 Eglinton Ave E #502,

Toronto, ON M4P 2Y3

[hidden email]  

CHAT:

  - IRC: http://webchat.freenode.net/?channels=#swt

  - MatterMost: https://mattermost.eclipse.org/eclipse/channels/platform-swt


_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
Reply | Threaded
Open this post in threaded view
|

Re: Performance of event handling

Thomas Singer
Hi all,

I've done some measurements with SmartGit (manually performed: starting,
selecting a modified file, reverting it): the results on my Core-i5
desktop machine:

First 5000 events: 137-170us/event
First 7500 events: 149-158us/event

With the attached rewritten EventTable code (events sorted by type,
binary search) the times are not noticeable different:

First 5000 events: 127-155us/event
First 7500 events: 138-175us/event

Hence, it makes sense to keep the current implementation as is.

--
Best regards,
Thomas Singer
=============
syntevo GmbH
http://www.syntevo.com
http://www.syntevo.com/blog


On 2017-07-18 18:56, Leo Ufimtsev wrote:

> Hey ya,
>
> I'm not aware of event-based performance tests being done in the last ~3
> years or so. The eventTable code looks pretty old.
> Sorting the event table upfront might indeed improve performance somewhat,
> but it might also increase code clutter.
>
> I would be happy to review a patch if there is an accompanying snippet that
> shows improvement in performance across platforms.
>
> Thank you
>
> Leo
>
>
> On Tue, Jul 18, 2017 at 3:36 AM, Thomas Singer <[hidden email]> wrote:
>
>> Hello experts,
>>
>> Are there already some researches regarding the performance of event
>> handling in SWT for non-trivial applications? From time to time I need to
>> debug our application through code of SWT event handling and depending on
>> the control there are quite a large number of listeners and for each event
>> it steps through all the listeners. Wouldn't it be more efficient if adding
>> a listener would sort them by their event type, so the loop knows when it
>> can abort earlier? Wouldn't it be better, to ensure to have just 1 (instead
>> of multiple) listeners of the same type, so the array of all listeners
>> could be binary searched?
>>
>> --
>> Best regards,
>> Thomas Singer
>> =============
>> syntevo GmbH
>> http://www.syntevo.com
>> http://www.syntevo.com/blog
>> _______________________________________________
>> platform-swt-dev mailing list
>> [hidden email]
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>>
>
>
>
>
>
> _______________________________________________
> platform-swt-dev mailing list
> [hidden email]
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>

_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

patches.zip (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Performance of event handling

Leo Ufimtsev-2
Hello Thomas,

Thank you for investigating this. Looks like quite a bit of work there.

Too bad that the sorting didn't improve performance. But it's good to know nevertheless.

I can't think of anything else that could improve performance of events at the code level.

On Mon, Aug 14, 2017 at 10:04 AM, Thomas Singer <[hidden email]> wrote:
Hi all,

I've done some measurements with SmartGit (manually performed: starting, selecting a modified file, reverting it): the results on my Core-i5 desktop machine:

First 5000 events: 137-170us/event
First 7500 events: 149-158us/event

With the attached rewritten EventTable code (events sorted by type, binary search) the times are not noticeable different:

First 5000 events: 127-155us/event
First 7500 events: 138-175us/event

Hence, it makes sense to keep the current implementation as is.

--
Best regards,
Thomas Singer
=============
syntevo GmbH
http://www.syntevo.com
http://www.syntevo.com/blog


On 2017-07-18 18:56, Leo Ufimtsev wrote:
Hey ya,

I'm not aware of event-based performance tests being done in the last ~3
years or so. The eventTable code looks pretty old.
Sorting the event table upfront might indeed improve performance somewhat,
but it might also increase code clutter.

I would be happy to review a patch if there is an accompanying snippet that
shows improvement in performance across platforms.

Thank you

Leo


On Tue, Jul 18, 2017 at 3:36 AM, Thomas Singer <[hidden email]> wrote:

Hello experts,

Are there already some researches regarding the performance of event
handling in SWT for non-trivial applications? From time to time I need to
debug our application through code of SWT event handling and depending on
the control there are quite a large number of listeners and for each event
it steps through all the listeners. Wouldn't it be more efficient if adding
a listener would sort them by their event type, so the loop knows when it
can abort earlier? Wouldn't it be better, to ensure to have just 1 (instead
of multiple) listeners of the same type, so the array of all listeners
could be binary searched?

--
Best regards,
Thomas Singer
=============
syntevo GmbH
http://www.syntevo.com
http://www.syntevo.com/blog
_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev






_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev



--

Leo Ufimtsev

Software Engineer

Red Hat


90 Eglinton Ave E #502,

Toronto, ON M4P 2Y3

[hidden email]  

CHAT:

  - IRC: http://webchat.freenode.net/?channels=#swt

  - MatterMost: https://mattermost.eclipse.org/eclipse/channels/platform-swt


_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev