mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Python: Fix slow use of regexCapture in Builtin::strValue
This is only _really_ expensive when there are a _lot_ of strings in the database, but for this case, where we're always extracting the same substring of the string, it's easier -- and faster -- to just make a substring operation directly.
This commit is contained in:
@@ -104,7 +104,8 @@ class Builtin extends @py_cobject {
|
||||
) and
|
||||
exists(string quoted_string |
|
||||
quoted_string = this.getName() and
|
||||
result = quoted_string.regexpCapture("[bu]'([\\s\\S]*)'", 1)
|
||||
// Remove prefix ("b" or "u") and leading and trailing quotes (both "'").
|
||||
result = quoted_string.substring(2, quoted_string.length() - 1)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user