-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ideas to improve performance of Ferrisetw #25
Comments
Most of this is done in upcoming MRs. There is one optimization we could do however. For later:
|
Most of it has been done, and is included in ferrisetw 1.0. I'm leaving this issue open because there is still little room for improvement. But gaining perfs is becoming harder and harder now. |
Here are a few ideas I had when reading the code before profiling it.
Feel free to add any remarks and comment :)
How important and efficient are all these ideas?
TODO: use a profiler to benchmark the few places that look time-consuming.
When a callback is called (how is the Schema built?)
EVENT_RECORD
isCopy
. Depending on how the compiler optimizes it, it is possibly copied at every function call:ctx.on_event(*event_record);
prov.on_event(record, locator);
, once for each providercallbacks.iter_mut().for_each(|cb| cb(record, locator))
, once for each callback of each providerEven in cases where there is a single provider with a single callback, that may be quite a lot of copies (especially as
EVENT_RECORD
is quite large).Solution:
&EVENT_RECORD
.This would require
Schema
to not own itThat's for the event payload part.
Considering the ETW schema, it is properly cached in the
SchemaLocator
and is retrieved quickly.When a Parser is created
One of the first steps in the callback is to call
Parser::create(&schema)
. ThisPropertyIter::enum_properties()
for every event record, although this only depends on the schema, not on the record itself!enum_properties()
builds aVec<Property>
)either build it one per actual schema (not per RecordAndSchema)(not possible, see next comment)Here as well, splitting Schema from the EventRecord would be a good thingWhen a Property is accessed
parser.try_parse(...)
does many things. But most work is done infind_property()
Parser
...which depends on the event recordThis would require reviewing the code, and split it into two parts: the record-dependant and record-independant code
Note: API changes
Currently, the callbacks are passed an
EVENT_RECORD
and aSchemaLocator
.As stated in a TODO in the code, this is not straighforward. We could/should:
&EVENT_RECORD
, see above)Do not pass the(bad idea, some callbacks do not need theSchemaLocator
, but theSchema
directlySchema
. Let's keep giving them the ability to retrieve it or not)Schema
would probably not own the event record (nor a ref to it).Parser
instead of aSchema
is probably not a good idea. The end user may want to avoid its creation on most events, and create it only for e.g. event IDs that interest himThe text was updated successfully, but these errors were encountered: