开发者

What are the disadvantages of using backend generated Javascript or CSS?

Just curio开发者_运维百科us. My thought is that generated files have negligible overhead in terms of performance but I could be mistaken.

Any thoughts on this?


There is definitely the negligible overhead for generating the script.

The second (that you'd find out as soon as you started development) is that debugging the script becomes infinitely more difficult.


There are two possibilities here.

Firstly you could be speaking of abstractions for CSS and Javascript (eg GWT) that effectively cross-compile one language to another. Hand-coded Javascript will typically be smaller and more efficient but could take considerably longer to create depending on how high a level the abstraction is. Performance of the cross-compiled version? I've heard claims GWT is within 10% of "pure" Javascript performance. I'm not completely convinced of that but it's the right order of magnitude.

Secondly you could be referring to what is still hand coded Javascript or CSS but has some extra stuff thrown on top. CSS variables are a common example. As long as you don't generate them on every request (ie you cache them in some way) then yes the performance is negligible. Even if you do generate them on every request I'm not sure you'd notice the performance impact (on the client side). The server may suffer depending on the complexity of processing and how often the file is requested (which shouldn't be often if it's effectively cached on the client with far futures Expires headers and so on).


These couple of SO posts will help:

Server Side Javascript: Why?
When and how do you use server side JavaScript?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜