Open vinistock opened 2 months ago
I took a quick stab at this and managed to get most of it working. Branch.
Currently, that branch defines a task to profile the current file opened in the editor and adds a button on the editor navigation for convenience. After running the script with Vernier, it will then open a web view just showing the profile's JSON content.
The part missing is the visualization, for which we have two options:
.cpuprofile
and .heapprofile
files, which automatically get handled with table or flamegraph views.From a maintenance and DX standpoint, I would prefer number 2. That would mean that Ruby profiles are treated the same as JavaScript ones - keeping consistency. And we wouldn't need any implementation or extra dependencies because it's baked in VS Code already.
However, I do not know if these cpuprofile
and heapprofile
extensions are applicable to Ruby. And even if they are, it does not look like Vernier supports either of those yet. Need to do some more research.
It would be amazing if we could profile a given Ruby script/executable using vernier and then show the results inside of the editor.
VS Code doesn't have profiling APIs yet and I'm not sure if this is planned or not. Which means we need to build everything custom. However, we may be able to show the generated webpage that you'd normally view in the Firefox profiler view within a VS Code webview.