zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #24896
[Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba
Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.
Commit message:
Optimization for same sentence/paragraph.
Requested reviews:
Paul J. Lucas (paul-lucas)
For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178871
Optimization for same sentence/paragraph.
--
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/178871
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/full_text/apply.cpp'
--- src/runtime/full_text/apply.cpp 2013-06-12 00:21:05 +0000
+++ src/runtime/full_text/apply.cpp 2013-08-07 01:20:38 +0000
@@ -770,9 +770,12 @@
FOR_EACH( ft_all_matches, m, am ) {
bool every_satisfies = true;
- FOR_EACH( ft_match::includes_t, i1, m->includes ) {
- FOR_EACH( ft_match::includes_t, i2, m->includes ) {
- if ( &*i1 != &*i2 && !same( *i1, *i2, sep ) ) {
+ if ( m->includes.size() > 1 ) {
+ ft_match::includes_t::const_iterator i( m->includes.begin() );
+ ft_match::includes_t::const_iterator const end( m->includes.end() );
+ ft_match::includes_t::value_type const &first = *i;
+ while ( ++i != end ) {
+ if ( !same( first, *i, sep ) ) {
every_satisfies = false;
break;
}
=== modified file 'src/runtime/full_text/ft_match.h'
--- src/runtime/full_text/ft_match.h 2013-02-07 17:24:36 +0000
+++ src/runtime/full_text/ft_match.h 2013-08-07 01:20:38 +0000
@@ -19,6 +19,7 @@
#include <algorithm>
#include <list>
+#include <vector>
#include "ft_token_span.h"
@@ -65,7 +66,7 @@
/**
* An %ft_string_matches contains zero or more ft_string_match objects.
*/
-typedef std::list<ft_string_match> ft_string_matches;
+typedef std::vector<ft_string_match> ft_string_matches;
///////////////////////////////////////////////////////////////////////////////
@@ -94,7 +95,7 @@
if ( !includes_sorted_ ) {
includes_sorted_ = true;
#endif
- includes.sort();
+ std::sort( includes.begin(), includes.end() );
#if FT_MATCH_OPTIMIZE_SORT
}
#endif
Follow ups