Hey, I've tried to replace logic for AST to text generation from string concatenation to a common stringbuilder, but it gave only about 5% boost. It's available here: https://github.com/krzema12/kotlin-python/tree/2021-07-30-stringbuilder
I wasn't able to profile a test run. It seems profiling isn't available in IDEA for test tasks. We can still try profile running profiler manually somehow. Another thing I've tried is to convert test source root to main, but I've stuck with some error related to unavailable IDEA installation required by calls to IDEA logger and other classes.
I think I will shelve the task of optimizing tests for now. Will continue with box tests themselves
This is 100 times of the same test running on the current version: 46 seconds in total.
And for common StringBuilder, I get 43 seconds.
IMO not a meaningful speedup to sacrifice code readability. Do you agree?
Thanks for checking it!
s
SerVB
07/30/2021, 7:07 PM
I don't have a preference. I don't think readability became much worse. And I agree performance boost is minor.
The only positive thing with StringBuilder is that I somehow managed to avoid trailing spaces: https://github.com/krzema12/kotlin-python/commit/8c1ea22742d810d9dd69da283207cb3f85fad97b. In the current implementation, we have them many.
Let's leave Strings for now: we have more important things
👍 1
p
Piotr Krzemiński
08/14/2021, 11:35 AM
I found a clue on why the box tests got so much longer: some cases produce Python code with infinite recursion and either a stock overflow or some kind of timeout happens. Then instead of a test case where compilation takes a few seconds and execution a dozen milliseconds, the execution takes several seconds or more. I found this issue when working on property initializers.