Then, click on the most-left icon to download the. When you’re done, go back to the Running Extension tab and stop the recording. In the case of Abracadabra, I was suspecting performance issues on Quick Fixes, so I moved my cursor around the code, to trigger Quick Fixes. It will turn red, meaning it’s recording. On the top right, you have a series of icons that will allow you to record a performance profile of the extension at runtime.Ĭlick on the record button (the dot in the circle). So how can we track that? Record Extension profile But if you’re probably concerned with your extension runtime performance. Now, that was for startup activation time. It tells you the time each extension took to activate.Īs a rule of thumb, if your extension takes more than 500ms to activate, there’s probably something you could do to speed that up-it’d be a good idea to bundle your extension if you don’t do that already. The first thing you can see from this tab is the Startup Activation time. That will open a tab wich list your running extensions: In the Extension Host, open the Palette ( ⌘ ⇧ P / Ctrl Shift P) and search for Show Running Extensions. Debugging your extension opens an extension host that will compile your extension code, so you can run it live. You certainly want to measure performance before and after your changes. The first thing you need to do is to debug your extension. VS Code provides quite a good tooling to do so. How to measure the performance of a VS Code Extension? That’s how you know if you need to improve it or if it’s good enough. That’s why I think you shouldn’t improve performance without measuring it. Improving performance is a tradeoff on code maintainability. Improving performance implies writing less naive, harder to maintain code to make it fast enough for the users. It kept the code simple, allowing me to develop more and understand the problem better. At that time, despite the theory, I couldn’t feel performance issues from usage. Indeed, I thought about it at the beginning, 2 weeks after the very first release. That doesn’t sound very performant, does it? Any time the cursor changes position, VS Code would ask Abracadabra the same question: what are the relevant refactorings on this code, from the current selection? Hence, any time the cursor changes position, Abracadabra recomputes all refactorings of the catalog, again. Each refactoring that could change the code would be considered relevant. To determine what are the relevant refactorings, Abracadabra naively tries to perform each of them. Regarding where your cursor is, VS Code will tell you the relevant refactorings you can perform through the lightbulb □ Most refactorings are exposed as VS Code Quick Fixes. Today, it makes me much more productive when I code. A few months after the first release, I had developed more than 20 automated refactorings. During this process, I took decisions I knew were a bit naive from a performance standpoint, but they simplify a lot the development. As I learned along the way, I kept refactoring the code to improve readability, thus maintainability. I first developed the features I needed and shipped that. “Make it work, make it right, make it fast.”Ībracadabra is a side-project. When I make things, I try to follow the mantra: How do you know you need to improve performances? In this article, I’ll explain how I did that, so you can do the same. Recently, I looked for performance bottlenecks to make it faster. I’m developing a VS Code Extension that provides intuitive automated refactorings in JavaScript and TypeScript.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |