Bad compiler performance
Describe the bug
- typespec server slow and keeps crashing in vscode
- duplicate model error when running tsp compile main.tsp (see readme of reproduction)
I think they are not related but figured it could be because of something that is infinite looping causing the server crash, that is why I left it in here.
When starting the typespec server, going to definitions is slow/does not work (when ctrl + hovering you see loading...). If you restart the typespec server then and see the output, you see that the server crashed.
When running the compiler you also see a duplicate model error, commenting out that does fix it, but I figured to leave it in here in case it is related.
When there is an error somewhere in the code, the typespec error does not crash. This leads me to believe that maybe there is a bug with importing files (or obviously I am doing something wrong)
Reproduction
https://github.com/VictorVermeulen/typespecdebug/tree/master
Checklist
- [x] Follow our Code of Conduct
- [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- [x] The provided reproduction is a minimal reproducible example of the bug.
Split the error part into this issue #7294
Thank you for reporting this issue!
The performance issue was related to an unoptimized function used by a dependency of the openapi3 emitter (asset-emitter). https://github.com/microsoft/typespec/pull/7306 optimizes that function to improve its performance ~100x. When I tested against your repo locally, this function (called over 100,000 times for your repo) was taking ~6-7 seconds of the emit time, now down to ~60-70 ms.
The performance issue should be resolved now with the just released @typespec/asset-emitter version 0.70.1. Do you mind installing that version and let us know if that solves the performance side of things for your project?
Hi @chrisradek It looks to be working indeed! Thanks for taking care of this in just a few days, much appreciated.