anchor regexp

Anchoring this regexp (i.e., making it start with a "^") reduces the time
it takes to load the first CP plot from 10 seconds to 6.5 seconds on
Sean's three years of rides.  Unbelievable, but repeatable.
This commit is contained in:
Sean Rhea
2009-11-06 23:43:35 -05:00
parent c71f38ecb0
commit 2f8d1013be

View File

@@ -201,7 +201,7 @@ done:
QDate
cpi_filename_to_date(const QString filename) {
QRegExp rx(".*(\\d\\d\\d\\d)_(\\d\\d)_(\\d\\d)_\\d\\d_\\d\\d_\\d\\d\\.cpi$");
QRegExp rx("^(\\d\\d\\d\\d)_(\\d\\d)_(\\d\\d)_\\d\\d_\\d\\d_\\d\\d\\.cpi$");
if (rx.exactMatch(filename)) {
assert(rx.numCaptures() == 3);
QDate date = QDate(rx.cap(1).toInt(),