>From 3f84440651064c5352bfa5db7e0ca4610599a127 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 15 Feb 2015 15:45:58 +0100 Subject: [PATCH] Micro optimization in CensusView::column_value_varies_across_cells(). Move an invariant value out of the loop to speed up this function by ~25%. --- census_view.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/census_view.cpp b/census_view.cpp index 50ea156..cfc3f66 100644 --- a/census_view.cpp +++ b/census_view.cpp @@ -933,10 +933,12 @@ Input* CensusView::class_parms_from_class_name(std::string const& class_name) ,std::vector const& cells ) const { + const any_member& case_value = case_parms()[0][header]; + typedef std::vector::const_iterator ici; for(ici j = cells.begin(); j != cells.end(); ++j) { - if(!((*j)[header] == case_parms()[0][header])) + if(!((*j)[header] == case_value)) { return true; } -- 2.1.0