twibiral / obsidian-execute-code

Obsidian Plugin to execute code in a note.
MIT License
1.06k stars 67 forks source link

Request for a Python Code Profiling Feature #311

Open HoBeom opened 9 months ago

HoBeom commented 9 months ago

I'm currently looking for a way to automatically measure the execution time of Python code, particularly on a block-by-block basis. I've explored tools like timeit, perf, richbench, and hyperfine, but I encountered limitations such as not being able to easily inject code at the end of the target code or not effectively handling arguments with -m or -mod.

Among these tools, hyperfine seems to be the most promising one, but it lacks the ability to display the results conveniently.

I'm looking for an alternative solution or enhancement to existing tools that allows measuring the execution time of Python code blocks, supports injecting code both before and after the target code, and handles arguments effectively, especially with -m and -mod options.

Expected Behavior:

Additional Information: I believe that having such a feature or tool would greatly benefit Python developers and help in optimizing code performance.

Thank you for considering this feature request.

twibiral commented 9 months ago

Hi, that's a neat idea! I think we can implement it easily in TypeScript so that it automatically works for all supported languages.