Only compile FlashDownloadInterception regexes once.
RE2::PartialMatch and friends don't take the regex as a string. They take it as an RE2 object, which has an implicit conversion from string. Instead, keep the compiled RE2 objects around. This brings the cost of running FlashDownloadInterceptionTest.DownloadUrlVariations 1000 times in a loop from 5.7s to 200ms. Bug: none Change-Id: I83b81219a4f84ac810a2bfca40e4267579a05db9 Reviewed-on: https://chromium-review.googlesource.com/1115369Reviewed-by:Tommy Li <tommycli@chromium.org> Commit-Queue: David Benjamin <davidben@chromium.org> Cr-Commit-Position: refs/heads/master@{#570495}
Showing
Please register or sign in to comment