Commit 131ad8c
Reuse the same Variant(None) on emitting events for non-existant fields
Clients registering for multiple event types will usually construct a
select clause selecting _all_ fields of all subscribed events. For
example when subscribing for all events in server-events.py with
UaExport causes a ~200 field select clause.
When triggering an event we walk all requested fields in the select
clause (even though the event being triggered right now only has a few
of them).
In the server-events.py example this behavior causes quite some
overhead as from the ~200 requested fields only a few need to be
populated. For all other items a Variant(None) is instantiated.
Instead of instantiating a new Variant(None) for every none-existant
field we can just reuse the same instance for all none existant fields.
In my tests this caused a speed up >50% (~5ms -> ~2ms) for triggering
an event if a client with a large select clause is subscribed.1 parent d92ad54 commit 131ad8c
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
0 commit comments