-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
string_processing: Performance regression #2314
Comments
Assigning to myself to do profiling to figure out the cause |
Here's some profiling output on the latest release:
The problem is mostly that Perhaps this can be improved by adding more |
Because I'm bored, here's a test case generator for this (don't @ me if this turns out to be garbage :p): import random
lines = []
lines.append("a = [")
for _ in range(300):
size = random.randint(30, 120)
string = "".join([chr(random.randint(65, 122)) if random.random() < 0.8 else " " for _ in range(size)])
clean = string
for no in r'#"\{}':
clean = clean.replace(no, "")
comma = "," if random.random() > 0.5 else ""
lines.append(f' "{clean}"{comma}')
lines.append("]")
with open("out.py", "w", encoding="utf8") as f:
f.write("\n".join(lines)) |
#3467 makes this better but I'm still seeing about a 4.5x perf regression (though without mypyc) on an internal file:
|
With mypyc-compiled on an M1 Mac it's much better after the initial reformat:
So from 2 s to 3 s, still a significant slowdown but not as concerning. |
I can't share the file since it's private code, but it's 14000 lines of a single list display.
The text was updated successfully, but these errors were encountered: