Fix performance issue in StringAuthLeakDetector
authorMatthew Gharrity <gharrma@google.com>
Tue, 9 Jul 2019 19:34:01 +0000 (12:34 -0700)
committerMatthew Gharrity <gharrma@google.com>
Thu, 1 Aug 2019 22:55:00 +0000 (22:55 +0000)
commitefcfb8dadfb647d876ba0881ff35098d9904868a
tree8ea1d45c43959c5aeafa7542ddba587029370c6d
parent5e870417f7d5e0e39a33824881c0da04fd101bcf
Fix performance issue in StringAuthLeakDetector

Java regex matching can actually be quite slow.
In the case of StringAuthLeakDetector, it could take
10s to match a string of length 50k. We fix this by
only looking at strings of length 512 or less, which
take less than 10ms to match.

Test: existing (StringAuthLeakDetectorTest), and manual timing tests
Fixes: 133377376
Change-Id: I4ea4abf41a7a7015bdc8407c61aa6409fa5f6337
(cherry picked from commit 173358c301b2e0a7819b96edf924f86243de4960)
lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/StringAuthLeakDetector.java