New issue
Advanced search Search tips

Issue 783187 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Mar 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

FilterTests is extremely slow

Reported by kind...@yandex-team.ru, Nov 9 2017

Issue description

Steps to reproduce the problem:
1. Prepare build env for Android.
2. Compile a test binary with many tests: "ninja -C out/Default net_unittests"
2. Run tests with 100 items in the negative part of gtest filter : "./out/Default/bin/run_net_unittests gtest -v  -f=DiskCacheEntryTest.SimpleCacheInFlightTruncate:HttpCacheTests/ClustersHttpCacheTest.ReceivedBytesConditionalRequest200/*:<and 99 more>"
In our case we had "*" in half of them.
3. Test running script hangs about 8 min at this place:
build/util/lib/common/unittest_util.py#FilterTestNames

What is the expected behavior?
This code (FilterTestNames) should run in seconds or even milliseconds.

What went wrong?
Probably too many iterations of fnmatch.fnmatch(), about 2 millions.

Did this work before? N/A 

Chrome version: does not matter  Channel: n/a
OS Version: 
Flash Version: does not matter
 
I have a fix for this and going to commit it. Just created issue to better describe the problem.
Components: Build
Labels: TE-NeedsTriageHelp
> 2. Run tests with 100 items in the negative part of gtest filter : "./out/Default/bin/run_net_unittests gtest -v  -f=DiskCacheEntryTest.SimpleCacheInFlightTruncate:HttpCacheTests/ClustersHttpCacheTest.ReceivedBytesConditionalRequest200/*:<and 99 more>"

Correction:
"./out/Default/bin/run_net_unittests gtest -v  -f=-DiskCacheEntryTest.SimpleCacheInFlightTruncate:HttpCacheTests/ClustersHttpCacheTest.ReceivedBytesConditionalRequest200/*:<and 99 more>"
Project Member

Comment 5 by bugdroid1@chromium.org, Dec 21 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/da0240761319bc610c7c4121d76659c7364b79bb

commit da0240761319bc610c7c4121d76659c7364b79bb
Author: Dmitry Trofimovich <kindrik@yandex-team.ru>
Date: Thu Dec 21 18:09:07 2017

Optimize FilterTestNames() by using precompiled patterns.

Previous implementation was slow when you put too many items in
the negative part of gtest filter (with positive part = *).
For net_unittests we have 2 mln fnmatch.fnmatch() calls.
Using one re match() instead of repetitive fnmatch() is much faster.
This change makes it more than 1000 times faster in heavy scenarios
(0.1 sec instead of 8 min for net_unittests with 100 negative items).

R=alexandermont@chromium.org, jbudorick@chromium.org

Bug:  783187 
Change-Id: I70b0487e451cfc0457a683d4e1ef5de2a8bee732
Reviewed-on: https://chromium-review.googlesource.com/758853
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525737}
[modify] https://crrev.com/da0240761319bc610c7c4121d76659c7364b79bb/build/util/lib/common/unittest_util.py

Hope this is fixed, closing for now. Please reopen if needed.
Status: WontFix (was: Unconfirmed)

Sign in to add a comment