import.nvim icon indicating copy to clipboard operation
import.nvim copied to clipboard

Consider adding more profiling/debugging tools

Open miversen33 opened this issue 3 years ago • 5 comments

Some ideas that have been floating in my head

  • A way to flamegraph (like plenary) that is usable/interactable in the output window in import
  • Add a way to trace memory usage during an import
  • Overwrite all nested requires (during an import) with a masked import call so they can be tracked
    • To clarify, this would be like, if you imported a module, anything that is "required" in that module would actually use import (and be marked as a dependency in import). This would allow you to better track dependencies of modules.
  • Create a "replay" queue so reloading of a config can actually be done
  • Track changes to anything in global scope so you can truly "revert" those changes on a reload

Note: I will not attempt to catch/intercept state writes to disk. That is just way too much work and not worth the effort of attempting to deal with.

Note Note: This is all just an idea bouncing in my head, this may end up being unceremoniously closed after I have had sleep and decided this was silly. Some of this may be developed. All of this may be developed. Something else entirely may be developed. Who knows. If you see this and think any of these items (or something else entirely) is useful, feel free to comment/react

miversen33 avatar Sep 23 '22 00:09 miversen33

I haven't had any urge to act on any of the above features. I posted on /r/neovim as well looking for feedback, however if I get none, I will probably just close this issue out and move this project into Maintenance mode. I'll give this a few days

miversen33 avatar Oct 19 '22 01:10 miversen33

I love the idea of flame graph and memory usage graphs, currently I just track it in task manager to debug plugins and its very annoying

shaunsingh avatar Oct 19 '22 02:10 shaunsingh

@shaunsingh its worth calling out that I wouldn't (likely) be able to track live memory usage of a plugin, this would be purely during the module import process. IE, when you call require, this would track the maximum memory consumed during that call.

Note, I have absolutely no idea how to do this, I am just spit balling ideas :)

miversen33 avatar Oct 19 '22 02:10 miversen33

  • Create a "replay" queue so reloading of a config can actually be done
  • Track changes to anything in global scope so you can truly "revert" those changes on a reload

I've been looking for a plugin which does this, if it works (given how hard it seems to this properly) it would be very nice for debugging a config. It seems to be quite hard to do properly however.

sandersantema avatar Oct 19 '22 11:10 sandersantema

  • Create a "replay" queue so reloading of a config can actually be done
  • Track changes to anything in global scope so you can truly "revert" those changes on a reload

I've been looking for a plugin which does this, if it works (given how hard it seems to this properly) it would be very nice for debugging a config. It seems to be quite hard to do properly however.

@sandersantema I've got a few ideas in mind but they range from

Oh god thats awful

to

Jesus that's invasive

So I haven't pursued it too much as I was unsure if the feature would be of interest to others. I'll ponder this and come back to this issue next weekend (ish?), hopefully with an idea of how to approach this. Knowing others are interested is the main goal here :)

miversen33 avatar Oct 20 '22 01:10 miversen33

Closing this out, refer to #17 for next feature work :)

miversen33 avatar Oct 25 '22 20:10 miversen33

@miversen33 do you mean #17?

kamalmarhubi avatar Oct 29 '22 03:10 kamalmarhubi

@miversen33 do you mean #17?

Good call, typing is hard

miversen33 avatar Oct 29 '22 03:10 miversen33