This is an automated email from the ASF dual-hosted git repository. gsim pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push: new 8a169c3 DISPATCH-1500: improve efficiency of parsing and processing for large MAU 8a169c3 is described below commit 8a169c35a1b8035f173691fb669d94edba123b30 Author: Gordon Sim <g...@redhat.com> AuthorDate: Thu Nov 28 18:27:47 2019 +0000 DISPATCH-1500: improve efficiency of parsing and processing for large MAU --- include/qpid/dispatch/parse.h | 3 +++ python/qpid_dispatch_internal/router/node.py | 21 +++++++++------------ src/parse.c | 10 ++++++++++ src/python_embedded.c | 7 ++++--- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/include/qpid/dispatch/parse.h b/include/qpid/dispatch/parse.h index 8397742..7fed15d 100644 --- a/include/qpid/dispatch/parse.h +++ b/include/qpid/dispatch/parse.h @@ -243,6 +243,9 @@ qd_parsed_field_t *qd_parse_sub_key(qd_parsed_field_t *field, uint32_t idx); */ qd_parsed_field_t *qd_parse_sub_value(qd_parsed_field_t *field, uint32_t idx); +qd_parsed_field_t *qd_field_first_child(qd_parsed_field_t *field); +qd_parsed_field_t *qd_field_next_child(qd_parsed_field_t *field); + /** * Convenience Function - Return true iff the field is a map. * diff --git a/python/qpid_dispatch_internal/router/node.py b/python/qpid_dispatch_internal/router/node.py index 6ec5227..02cfee2 100644 --- a/python/qpid_dispatch_internal/router/node.py +++ b/python/qpid_dispatch_internal/router/node.py @@ -406,7 +406,7 @@ class RouterNode(object): self.next_hop_router = None self.cost = None self.valid_origins = None - self.mobile_addresses = [] + self.mobile_addresses = set([]) self.mobile_address_sequence = 0 self.need_ls_request = True self.need_mobile_request = False @@ -542,7 +542,7 @@ class RouterNode(object): def map_address(self, addr, treatment = -1): - self.mobile_addresses.append(addr) + self.mobile_addresses.add(addr) self.adapter.map_destination(addr, treatment, self.maskbit) self.log(LOG_DEBUG, "Remote destination %s mapped to router %s" % (self._logify(addr), self.id)) @@ -555,19 +555,16 @@ class RouterNode(object): def unmap_all_addresses(self): self.mobile_address_sequence = 0 - while self.mobile_addresses: - self.unmap_address(self.mobile_addresses[0]) - + for a in self.mobile_addresses: + self.adapter.unmap_destination(addr, self.maskbit) + self.log(LOG_DEBUG, "Remote destination %s unmapped from router %s" % (self._logify(addr), self.id)) - def overwrite_addresses(self, addrs): + def overwrite_addresses(self, addrs_list): added = [] deleted = [] - for a in addrs: - if a not in self.mobile_addresses: - added.append(a) - for a in self.mobile_addresses: - if a not in addrs: - deleted.append(a) + addrs = set(addrs_list) + added = addrs.difference(self.mobile_addresses) + deleted = self.mobile_addresses.difference(addrs) for a in added: self.map_address(a) for a in deleted: diff --git a/src/parse.c b/src/parse.c index 78afc20..087b8d5 100644 --- a/src/parse.c +++ b/src/parse.c @@ -45,6 +45,16 @@ ALLOC_DEFINE(qd_parsed_field_t); ALLOC_DECLARE(qd_parsed_turbo_t); ALLOC_DEFINE(qd_parsed_turbo_t); +qd_parsed_field_t* qd_field_first_child(qd_parsed_field_t *field) +{ + return DEQ_HEAD(field->children); +} + +qd_parsed_field_t* qd_field_next_child(qd_parsed_field_t *field) +{ + return DEQ_NEXT(field); +} + /** * size = the number of bytes following tag:size (payload, including the count) * count = the number of elements. Applies only to compound structures diff --git a/src/python_embedded.c b/src/python_embedded.c index c822925..154ee00 100644 --- a/src/python_embedded.c +++ b/src/python_embedded.c @@ -347,12 +347,13 @@ PyObject *qd_field_to_py(qd_parsed_field_t *field) case QD_AMQP_LIST32: { uint32_t count = qd_parse_sub_count(field); result = PyList_New(count); - for (uint32_t idx = 0; idx < count; idx++) { - qd_parsed_field_t *sub = qd_parse_sub_value(field, idx); - PyObject *pysub = qd_field_to_py(sub); + qd_parsed_field_t *item = qd_field_first_child(field); + for (uint32_t idx = 0; item && idx < count; idx++) { + PyObject *pysub = qd_field_to_py(item); if (pysub == 0) return 0; PyList_SetItem(result, idx, pysub); + item = qd_field_next_child(item); } break; } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org