From 2f8d1013be209cde1a1ac9329cd0d12f3c8e8abd Mon Sep 17 00:00:00 2001 From: Sean Rhea Date: Fri, 6 Nov 2009 23:43:35 -0500 Subject: [PATCH] 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. --- src/CpintPlot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CpintPlot.cpp b/src/CpintPlot.cpp index 5e93c0833..c0686e9b4 100644 --- a/src/CpintPlot.cpp +++ b/src/CpintPlot.cpp @@ -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(),