I continued profiling and found that the performance issue is still with the same functions.
Methods that work with the head of an array (shift, unshift) are slow operations. So I changed them to work with cursor (index). This insignificantly affects the amount of memory consumed, since only references to objects are stored in the array.
Hi, it's me again!
I continued profiling and found that the performance issue is still with the same functions.
Methods that work with the head of an array (shift, unshift) are slow operations. So I changed them to work with cursor (index). This insignificantly affects the amount of memory consumed, since only references to objects are stored in the array.
The same benchmark as in my previous PR (https://github.com/stephenh/ts-poet/pull/38) showed the following results:
Not so impressive. But on my real input .proto is much better: 2s instead of 6s. This is close enough to how C++ plugins work.
Ts-poet tests are green. Ts-proto integration tests are also green.