[WIP]Performance[mqbi::DispatcherEvent]: replace multiple inheritance with variant#396
[WIP]Performance[mqbi::DispatcherEvent]: replace multiple inheritance with variant#396678098 wants to merge 3 commits intobloomberg:mainfrom
Conversation
e16b562 to
ef96296
Compare
| DispatcherEvent& setType(DispatcherEventType::Enum value); | ||
| inline DispatcherPutEvent& makePutEvent() | ||
| { | ||
| d_type = DispatcherEventType::e_PUT; |
There was a problem hiding this comment.
Do we even need to set this type anymore?
| bsl::shared_ptr<bdlbb::Blob> d_blob_sp; | ||
| // Blob of data embedded in this | ||
| // event. Refer to the corresponding | ||
| // accessor on the various | ||
| // DispatcherEvent view interfaces | ||
| // for more specific information. |
There was a problem hiding this comment.
| bsl::shared_ptr<bdlbb::Blob> d_blob_sp; | |
| // Blob of data embedded in this | |
| // event. Refer to the corresponding | |
| // accessor on the various | |
| // DispatcherEvent view interfaces | |
| // for more specific information. | |
| /// Blob of data embedded in this | |
| /// event. Refer to the corresponding | |
| /// accessor on the various | |
| /// DispatcherEvent view interfaces | |
| /// for more specific information. | |
| bsl::shared_ptr<bdlbb::Blob> d_blob_sp; |
Docstring style
| } | ||
|
|
||
| /// Destructor. | ||
| virtual ~DispatcherAckEvent(); |
There was a problem hiding this comment.
Do we need virtual destructors still?
There was a problem hiding this comment.
No, will clean up this
| // TODO refactor | ||
| if (mqbi::DispatcherEventType::e_PUSH == ev.type()) { | ||
| const_cast<mqbi::DispatcherPushEvent*>(ev.asPushEvent()) | ||
| ->setClusterNode(d_clusterNode_p); |
There was a problem hiding this comment.
Is the refactoring here to make asPushEvent and family to have a const and non-const overload?
| .setType(mqbi::DispatcherEventType::e_CALLBACK) | ||
| .setCallback(mqbi::Dispatcher::voidToProcessorFunctor(f)) | ||
| .setDestination(const_cast<mqbi::DispatcherClient*>(d_client_p)); | ||
| .setDestination(const_cast<mqbi::DispatcherClient*>(d_client_p)) |
There was a problem hiding this comment.
Little wary of this const cast, what's the reason this is okay?
| .makePushEvent() | ||
| .setBlob(appData) | ||
| .setOptions(options) | ||
| .setGuid(msgGUID) |
There was a problem hiding this comment.
Note that initially we are building DispatcherEvent, and after makePushEvent() we are calling setters for DispatcherPushEvent. So we switch between objects amidst these setters calls. This interface is not perfect, but I have plans to replace it by calling constructors with all args instead.
So instead of this
(*dispEvent)
.setSource(this) // DispatcherEvent
.makePushEvent() // !!! DispatcherPushEvent
.setBlob(appData) // DispatcherPushEvent
.setOptions(options) // DispatcherPushEvent
.setGuid(msgGUID) // DispatcherPushEvent
We will have smth like this:
(*dispEvent)
.setSource(this)
.makePushEvent(appData, options, msgGUID, ...)
I plan to do it in a separate PR, with performance benchmarks, to limit the number of changes in this PR.
5870886 to
adf9611
Compare
9c1186a to
4f7f605
Compare
4f7f605 to
2f56f75
Compare
6f1e149 to
4968e09
Compare
86ec727 to
615c13a
Compare
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
Signed-off-by: Taylor Foxhall <tfoxhall@bloomberg.net>
Signed-off-by: Taylor Foxhall <tfoxhall@bloomberg.net>
615c13a to
7895323
Compare
|
Replaced by #1116 |
Before
After