thomazthz / godot-wakatime

Godot plugin for metrics, insights, and time tracking automatically generated from your Godot usage. https://wakatime.com
MIT License
59 stars 11 forks source link

Plugin is significantly slowing down Godot 4 editor #10

Open HauntedBees opened 11 months ago

HauntedBees commented 11 months ago

I've been using this plugin since the 3.x days but recently I've noticed that Godot 4.1 had been running extremely slowly. I upgraded to 4.1.2 to see if that was the issue and it was still running slowly. After trying several other things, I started disabling plugins one by one, and after disabling godot-wakatime, everything is working as expected -- no delays when switching between scripts in the script editor, no freezing when trying to rotate a 3D scene. This is a recent issue; I'd been using v1.5.0 of the plugin for a few months now and only within the past few weeks has this slowness been noticeable.

Plugin Version: 1.5.0 Godot Version: v4.1.2.stable.official [399c9dc39] Platform: Linux Mint 21.1 Cinnamon 5.6.8 Kernel Version 5.15.0-86-generic Processor: Intel© Core™ i5-6600K CPU @ 3.50GHz × 4 Memory: 32GB

alanhamlett commented 11 months ago

@gandarez could it be one of the major changes recently? Upgrading chroma to V2 or guessing language from file contents

alanhamlett commented 11 months ago

@gandarez let's release a wakatime-cli update that adds ~/.wakatime.cfg config: disable_language_content_detection = true To return heartbeat.LanguageUnknown before reading file contents.

That way @HauntedBees can enable the config and see if the performance issue is fixed.

alanhamlett commented 11 months ago

Or it could be caused by 312ae92b4a40bd75ba117d9a8e826e7d371314d6. @HauntedBees can you try downgrading the plugin to the v1.4.0 and see if it's fixed?

alanhamlett commented 11 months ago

Also, is it always slow or only sometimes slow?

gandarez commented 11 months ago

The only thing I can see is Godot doesn't run the wakatime-cli in the background and freezes the main process?

gandarez commented 11 months ago

Looking deeper to the code it's using an older version of wakatime-cli v1.54.0. It should always use the latest version as much as possible.

https://github.com/thomazthz/godot-wakatime/blob/master/addons/wakatime/wakatime.gd#L9C7-L9C23

HauntedBees commented 11 months ago

Hi @gandarez - I updated the code to use the latest version of wakatime-cli - v1.85.1 - then re-enabled the plugin. It installed the right version, and immediately began running slowly again. When the plugin is active, switching between different scripts in the Script Editor goes from being immediate to taking over 2 seconds, and saving a file goes from taking under half a second to taking around 3 seconds.

I cannot downgrade to version 1.4.0 of godot-wakatime as 1.5.0 is the first version to support Godot 4.

gandarez commented 11 months ago

@thomazthz does wakatime-cli run in foreground and blocks the UI?