observing / square

The last build system you would ever want to use
MIT License
56 stars 9 forks source link

big delays in watch mode #28

Closed tadeuszwojcik closed 12 years ago

tadeuszwojcik commented 12 years ago

Hi, Not sure if it's just me or not, but I have about 3-5 seconds delays of getting notifications when file has changed, is it normal? OS: ubuntu 12.04 Cheers, Tadek

3rd-Eden commented 12 years ago

Hello Tadek,

I have noticed simular delays but not as substantial as yours. There are few things that might be causing this issue:

Are you watching a large directory with lots of files and folders? Is it a large file that you are changing? What editor do you use to change the file as different editors save in different ways. Also what do you think would be an "acceptable" delay?

Thanks again for reporting this

tadeuszwojcik commented 12 years ago

Hi, Thanks for quick response. I have about 30 files right now which are being watched. Size of each of those is about 1kb to 10kb at most. I sublime text 2. I'm using square with live watch mode to automatically reload page when any of files changes and ideally would like to have almost no delay in my workflow. I've debugged it a little yesterday and it seems that watch module is the bottleneck. Do you use square in similar way or only as build process step executed on CI server ?

Thanks, Tadek

3rd-Eden commented 12 years ago

Thanks for the information, I already suspected that the watch module might become an issue over time. So I guess I need to start rewriting it from scratch again in order to get some rock solid performance out of that beast.

It is certainly do-able (i'll check if I can do a quick port of an old watch module i wrote a year ago) As for my workflow..

For my work i'm currently using the live-reload to automatically refresh files and rebuild a combined JavaScript bundle for my start-up I use square to build a javascript bundle that can be deployed on third part sites.. So I'm currently using every aspect of square :)

When we deploy we usually run our build & testing process one more time and upload the files to our CDN.

tadeuszwojcik commented 12 years ago

Thanks! My goal was to user square instead of live-reaload as all-in-one solution as live-reload doesn't work on ubuntu as far as I remember.

3rd-Eden commented 12 years ago

@codefather

I have rewritten the watch module today, It uses the Node.js fs#watch method which supposed to be faster then fs#watchFile. I have integrated it with the current master branch so if you could test that out to see if that resolves your issues, it would be great.

tadeuszwojcik commented 12 years ago

@3rd-Eden just tried and it works blazingly fast ! thanks a lot ! One problem I have now is it doesn't watch for files in folders but only files specified in bundle.json and for my stylus files it doesn't work too well.

Great job, thanks again !

3rd-Eden commented 12 years ago

@codefather I'm glad that this resolves your performance issues. I realize that the watching behavior isn't optimal just yet, but that will be resolved when I push out another 0.0.x release.

Thanks for trying it out, I'll hope to push out a another release next week.