From e9aabf87ff40c4f9bcbbb37688eae1ba1c1e71e3 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 4 Dec 2007 19:33:34 +0000 Subject: Patch from Ted Ross I've been doing some work in TopicExchange and noticed an opportunity for optimization of the route method. The current code does a heap allocation per binding, per message. The optimization removes the per-binding allocation. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@601051 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/TopicExchange.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cpp/src/qpid') diff --git a/cpp/src/qpid/broker/TopicExchange.cpp b/cpp/src/qpid/broker/TopicExchange.cpp index 99c0d381c5..bc761cf34d 100644 --- a/cpp/src/qpid/broker/TopicExchange.cpp +++ b/cpp/src/qpid/broker/TopicExchange.cpp @@ -152,8 +152,9 @@ bool TopicExchange::isBound(Queue::shared_ptr queue, TopicPattern& pattern) void TopicExchange::route(Deliverable& msg, const string& routingKey, const FieldTable* /*args*/){ RWlock::ScopedRlock l(lock); + Tokens tokens(routingKey); for (BindingMap::iterator i = bindings.begin(); i != bindings.end(); ++i) { - if (i->first.match(routingKey)) { + if (i->first.match(tokens)) { Queue::vector& qv(i->second); for(Queue::vector::iterator j = qv.begin(); j != qv.end(); j++){ msg.deliverTo(*j); -- cgit v1.2.1