wakatime / sublime-wakatime

Sublime Text 2 & 3 plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/sublime-text
BSD 3-Clause "New" or "Revised" License
525 stars 47 forks source link

pythonw.exe and sublime_text.exe processes cause slowness when saving a file #44

Closed thecotne closed 9 years ago

thecotne commented 9 years ago

when i save file for about 2 seconds there are some pythonw.exe and sublime_text.exe processes and sublime becomes unresponsive (lagging)

i know its wakatime because i tested without wakatime and with wakatime

i have windows 7 64bit and sublime text 3084

alanhamlett commented 9 years ago

How many pythonw.exe processes are created? There should be only 1 pythonw.exe process created per heartbeat, and only 1 heartbeat should be sent when saving a file.

thecotne commented 9 years ago

around 4-6 and also some sublime_text.exe processes around 2-3

i have tested in another computer works correctly (only one)

i will test this tonight when i get home

alanhamlett commented 9 years ago

Very strange. I've only tested using 32bit Windows 7 and 8 virtual machines from http://modern.ie and never seen this, but I know a few people in the past had experienced more than 1 pythonw.exe opening. I thought it was just lingering processes from slow network, where the heartbeats were getting queued faster than they could be sent. Maybe it was #12 or #6.

What specs were the other machine where it worked correctly? Let me know what you find when testing... would love to be able to reproduce this and fix it.

thecotne commented 9 years ago

it's because gulp is creating 3 file each time i save file some times i hit ctrl+s twice so file is saved twice and 3 extra file is saved twice it's 8 pythonw.exe processes and it's too much for my CPU

it does not occurred on different computer because i have different gulp tasks and much better CPU

alanhamlett commented 9 years ago

What's gulp?

b51ae5c2c4fc540e3ea5b784dc9580e19d1d84f4 prevents sending more than one heartbeat every 2 seconds from write events, for when you're pressing save multiple times. Not sure why 3 python processes are created, since I only call Popen once.

I do call Popen when looking for python, but that should only happen once the first time the plugin loads.

thecotne commented 9 years ago

What's gulp? http://gulpjs.com/

so if last_active['file'] is not target_file it will send more then one heartbeat within 2 seconds

alanhamlett commented 9 years ago

Oh, I don't think I'm using gulpjs anywhere.

Yes, if the currently edited file changes it will send another heartbeat. That won't happen when saving a file, only when switching between tabs.

thecotne commented 9 years ago

haw you detect file saved?

also i have tested that if i don't have opened files witch are overridden when gulp runs only one heartbeat is sent but if i have opened all files witch are overridden when gulp runs around 6-8 heartbeat is sent

when gulp overrides file sublime text refreshes file i think it is triggering wakatime heartbeat

alanhamlett commented 9 years ago

acaad2dc83ce8c03fbe047e2e7dd341b9a4b02a3 and v4.0.2 of the plugin fixes this by only sending heartbeats for the currently active buffer

thecotne commented 9 years ago

thx