Details
-
Bug
-
Resolution: Fixed
-
Major
-
7.6.2
-
Untriaged
-
0
-
Unknown
-
March-June 24
Description
dynamic_cast is a slow operation and shouldn't be used in the hot DCP path.
Its currently being used in
ConnHandler* EventuallyPersistentEngine::tryGetConnHandler(
|
CookieIface& cookie) {
|
auto* iface = cookie.getConnectionIface().getDcpConnHandler();
|
if (iface) {
|
auto* handler = dynamic_cast<ConnHandler*>(iface);
|
if (handler) {
|
return handler;
|
}
|
throw std::logic_error(
|
"EventuallyPersistentEngine::tryGetConnHandler(): The "
|
"registered connection handler is not a ConnHandler");
|
}
|
|
return nullptr;
|
}
|
Which is being called every time the DCP producer calls step (which happens for every message sent over the the DCP stream).
The "sanity check" may be nice to have to track if someone suddenly added a new conn handler class, but its not worth the runtime cost. There is currently no plans of adding a new class and I'm pretty sure this isn't the only place one would need to change the logic if one decided to add a new class.