Closed gwer closed 1 year ago
Hey @gwer , this is great!
I must admit I went too long without paying attention to performance, and then recently got lucky that just switching from prettier to dprint gave a huge performance gain, and then I had stopped there.
I'll release a new version of this and then we can bump ts-poet in ts-proto and see how it works over there (i.e. the ts-proto integration tests can serve as another regression test of this change). But so far everything looks good to me!
I manually published ts-poet 6.2.0 with this change. Thanks again!
Hi!
I am using
ts-proto
and have noticed that the generation takes a very long time. With 2000 input lines and 25000 output lines, the generation takes 20 seconds.Plugin profiling showed that the issue is with
ts-poet
.I got rid of unnecessary tree traversals, and also optimized working with arrays. My .proto is now processed in 6 seconds.
I also made a simple benchmark to show the difference. The result is clearly visible on large files.
Benchmark results:
Tests are green. The outputs is the same for my inputs. But I'm not sure about the conditions in
deepFindAll
method. I may have missed some corner cases. So please double check this after me.