Hacker News new | comments | show | ask | jobs | submit login

Please do test it and post the results. It seems a real point of contention whether a single JS script can outperform page-specific scripts. The team behind the Rails assets pipeline has pushed the single script approach. It'll take some testing to lay the debate to rest.

I think there are a number of factors which will affect the outcome, including:

- number of $(document).ready() callbacks that check whether the current file should run within the single application.js approach. This could grow to be an issue with much larger apps.

- how often the application.js file gets invalidated by a deploy (if it is every deploy this may be annoying for users if there's always a large performance penalty on the first download - especially for apps where the usage isn't regular).

- in the 2 scripts version it's very unlikely that the heavyweight application.js global file will get invalidated regularly, but it is likely that several of the smaller specific page js files will get invalidated with each deploy.

I guess the question is whether downloading several smaller files for each deploy beats downloading the whole application.js file for each deploy (network overhead being the likely bottleneck here).


These are good points. I'll experiment. Thanks!


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact