donate-cpu.py: Optimize string concatenation (use list) (#1657)
Using a list and join it in the end is really much faster when there are several hundred or thousands of strings.
This commit is contained in:
parent
78ea6d71ac
commit
110248c8d8
|
@ -37,7 +37,7 @@ import platform
|
||||||
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
|
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
|
||||||
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
|
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
|
||||||
# changes)
|
# changes)
|
||||||
CLIENT_VERSION = "1.1.0"
|
CLIENT_VERSION = "1.1.1"
|
||||||
|
|
||||||
|
|
||||||
def checkRequirements():
|
def checkRequirements():
|
||||||
|
@ -266,18 +266,18 @@ def scanPackage(workPath, cppcheckPath, jobs, fast):
|
||||||
print('Crash!')
|
print('Crash!')
|
||||||
return -1, '', '', -1, options
|
return -1, '', '', -1, options
|
||||||
elapsedTime = stopTime - startTime
|
elapsedTime = stopTime - startTime
|
||||||
information_messages = ''
|
information_messages_list = list()
|
||||||
issue_messages = ''
|
issue_messages_list = list()
|
||||||
count = 0
|
count = 0
|
||||||
for line in stderr.split('\n'):
|
for line in stderr.split('\n'):
|
||||||
if ': information: ' in line:
|
if ': information: ' in line:
|
||||||
information_messages += line + '\n'
|
information_messages_list.append(line + '\n')
|
||||||
elif line:
|
elif line:
|
||||||
issue_messages += line + '\n'
|
issue_messages_list.append(line + '\n')
|
||||||
if re.match(r'.*:[0-9]+:.*\]$', line):
|
if re.match(r'.*:[0-9]+:.*\]$', line):
|
||||||
count += 1
|
count += 1
|
||||||
print('Number of issues: ' + str(count))
|
print('Number of issues: ' + str(count))
|
||||||
return count, issue_messages, information_messages, elapsedTime, options
|
return count, ''.join(issue_messages_list), ''.join(information_messages_list), elapsedTime, options
|
||||||
|
|
||||||
|
|
||||||
def splitResults(results):
|
def splitResults(results):
|
||||||
|
|
Loading…
Reference in New Issue