Skip to content
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

eventqueue process_all (or similar) #28

Closed
mattygiedt opened this issue Oct 26, 2021 · 2 comments
Closed

eventqueue process_all (or similar) #28

mattygiedt opened this issue Oct 26, 2021 · 2 comments

Comments

@mattygiedt
Copy link

This is not an actual issue, more of a feature request.

I'm wondering if it would be possible to support an additional process call on the eventqueue similar to boost SPSC: size_type pop(T * ret, size_type size)

The idea would be that for queue:

eventpp::EventQueue<
          EventType,
          void(Event&),
          EventPolicies> {};

your listener could handle:

queue.appendListener(event_type, [](Event* data, size_t count) {
...
});

Producers would still be able to enqueue one at a time.

Dispatch would look something like:

queue.process_all(max_size) where max_size is the largest number of elements possible supplied to the listener callback.

@wqking
Copy link
Owner

wqking commented Oct 26, 2021

Can you give a use case? I'm not sure how that's useful.
Currently you can either call processOne up to max_size times, or use processIf and in the condition func, max_size is checked. However, note that processIf will still loop through all items in the queue even if the condition func returns false.

@mattygiedt
Copy link
Author

Sure -- use case is handling large amounts of market data. I've found it more performant to vectorize (batch) the consumption of data on the 'other side' of your queue data structure. This allows you to efficiently understand book state in multiple update scenarios, and, if you're re-publishing that data, you can optimize the writing. (ie. zeromq::sndmore)

However, taking a closer look at process() I'm frankly not sure this would gain much as you would still need the for(auto & item : tempList) and somehow build the event array from each unique event type, and then dispatch that.

Appreciate the work you've done here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants