From 50e535ecbd147406cb67109e90dc511a99ce9628 Mon Sep 17 00:00:00 2001 From: oxarbitrage Date: Mon, 17 Jul 2017 15:33:08 -0700 Subject: [PATCH] improve performance --- libraries/app/database_api.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index d7dfd7c04a..94956efd0f 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -1034,7 +1034,8 @@ vector database_api_impl::get_call_orders(asset_id_type a, ui vector< call_order_object> result; auto itr_min = call_index.lower_bound(index_price.min()); - while( itr_min != call_index.lower_bound(index_price.max()) && result.size() < limit ) + auto itr_max = call_index.lower_bound(index_price.max()); + while( itr_min != itr_max && result.size() < limit ) { result.emplace_back(*itr_min); ++itr_min; @@ -1054,7 +1055,8 @@ vector database_api_impl::get_settle_orders(asset_id_ty vector result; auto itr_min = settle_index.lower_bound(mia.get_id()); - while( itr_min != settle_index.upper_bound(mia.get_id()) && result.size() < limit ) + auto itr_max = settle_index.upper_bound(mia.get_id()); + while( itr_min != itr_max && result.size() < limit ) { result.emplace_back(*itr_min); ++itr_min;