Earlier quoted context omitted.
You're right, that was too broad a statement. However, it is undeniable that in-browser compilation of CSS will always be slower than precompilation, as long as the compilation outputs CSS. For some people, this speed hit will never be negligible. But for those who don't need to squeeze every bit of performance out of their sites, it's sufficient that it only be an order of magnitude or two faster than the HTTP reque…
"As for serving it up as JSON: no one wants to write stylesheets in JSON." You don't have to. You can use a compiler to generate JSON to feed to the system, retaining the flexibility of having the compiler running but skipping the parsing step. Why not compile straight to CSS? Well, why not? For simple sites that may be just fine. For more complicated sites it might be desirable to screw with the CSS before compiling…
Less.js will obsolete CSS
111–120 of 131 posts
Re: Less.js will obsolete CSS
#112I don't know. As a fan of CSS I don't really "get" Less.js ... Sure I understand the benefit of defining certain properties, but are the benefits good enough to warrant depending on an additional javascript library for something like this? What happens if people block javascript? I don't know. It's not bad, but it's not for me. But going as fas as to say it will obsolete CSS, that's just too much.
Re: Less.js will obsolete CSS
#113Earlier quoted context omitted.
Fair enough. I'm running less.js from the command line using node.js on my old-ish MacBook pro: A trivial CSS file (foo {a: b}) takes about 0.11s. This is probably mostly time spent spawning Node and loading the JS. The combined CSS for GitHub, about 160K, takes about 1.6s. This is already longer than most HTTP requests. The doubled CSS for GitHub (the same CSS twice in a row), about 316K, takes about 4s. This is qui…
That's because the parser isn't optimized for compressed CSS. By airing the file out a bit (just adding some double line-breaks), and passing -O2, it goes down to 177ms :)
For what it's worth, -O2 brings the compile time for github.css down to about 1.5s.
Re: Less.js will obsolete CSS
#114What if the user uses noscript, or otherwise disable Javascript? Preventing cautious people from seeing the eye candy doesn't sound like a good idea.
Users running noscript are typically prepared for any site to look broken or not work as expected. They also comprise a tiny majority of visitors, so for all practical intents and purposes accommodating their case is not really a development priority.
(1) It's useless. Just pre-process the style sheets statically. No need for PHP, Ruby or any server side dynamic scripting whatsoever. It's simpler, and yields less requirements for everyone.
(2) It exclude users. Not only the paranoid ones that run noscript and adBlock, but also the ones that just don't have Javascript like Dillo users. (Dillo is interesting for old, weak computers.) That's still a tiny minority, but they do exist.
Something useless that exclude users clearly isn't the best tool for the job. Unless punishing noscript users is a feature… Now, of course javascript is more capable than (pre-processed) CSS alone. But the article didn't seem to use those capabilities.
Re: Less.js will obsolete CSS
#115Earlier quoted context omitted.
I demand a benchmark. Saying that something is just false without numbers to back it up is not something I have high trust in, and is the start of the gossip that causes internet wars. First back it up with numbers, then we talk.
The benchmark file, http://github.com/cloudhead/less.js/blob/master/benchmark/be... Which has all the features of LESS in it, and weighs 94KB (3600loc), compiles in 130ms on my macbook pro. I would say that's plenty fast. You can try it out by running `$ make benchmark`
It's also worth mentioning that plenty of people who care about page load times would still care about 130ms. It's not as glaringly awful as 1.5s, but it's definitely comparable to the sorts of times under discussion. See http://developer.yahoo.com/performance/rules.html and http://code.google.com/speed/page-speed/docs/rules_intro.htm...
Re: Less.js will obsolete CSS
#116Running a compiler in the browser in production will never be a good idea. If you care about the speed that your website displays -- and you should -- the slowdown caused by parsing, processing, and concatenating large amounts of CSS will dwarf over-the-wire time. People who seriously care about the usability of their sites have been spending a lot of effort recently figuring out how to get load times as fast as poss…
This is a red herring. Any compiler that is implemented in JavaScript can be run both in the browser at run-time (very convenient for developers), or once at deploy-time using one of the many server-side JavaScript platforms (better performance for deployments). In fact this is exactly what we do with Objective-J, and if Less.js doesn't already then I expect they will soon.
Re: Less.js will obsolete CSS
#117What if the user uses noscript, or otherwise disable Javascript? Preventing cautious people from seeing the eye candy doesn't sound like a good idea.
Users running noscript are typically prepared for any site to look broken or not work as expected. They also comprise a tiny majority of visitors, so for all practical intents and purposes accommodating their case is not really a development priority.
Re: Less.js will obsolete CSS
#118Earlier quoted context omitted.
You're right, that was too broad a statement. However, it is undeniable that in-browser compilation of CSS will always be slower than precompilation, as long as the compilation outputs CSS. For some people, this speed hit will never be negligible. But for those who don't need to squeeze every bit of performance out of their sites, it's sufficient that it only be an order of magnitude or two faster than the HTTP reque…
"As for serving it up as JSON: no one wants to write stylesheets in JSON." You don't have to. You can use a compiler to generate JSON to feed to the system, retaining the flexibility of having the compiler running but skipping the parsing step. Why not compile straight to CSS? Well, why not? For simple sites that may be just fine. For more complicated sites it might be desirable to screw with the CSS before compiling…
I'm certainly not afraid of compilers. I write Sass, so I'm pretty intimately familiar with what's going on. My point was not that compilers are inherently scary and/or slow (although I stand by my original point that if it's compiling to CSS it will always be at least somewhat slower). I was just making the claim that the current speed of less.js is too slow for practical production use.
Re: Less.js will obsolete CSS
#119Earlier quoted context omitted.
That's because the parser isn't optimized for compressed CSS. By airing the file out a bit (just adding some double line-breaks), and passing -O2, it goes down to 177ms :)
This is real CSS handwritten by real people. It's not compressed, it's just not in a fully-expanded style. If your parser is slow for reasonably formatted CSS, then your parser is slow. The best case can be as fast as you want, but real-world use is what matters. For what it's worth, -O2 brings the compile time for github.css down to about 1.5s.
Re: Less.js will obsolete CSS
#120Earlier quoted context omitted.
There are plenty of problems with CSS. You can't specify the width of an inline element, for one. That alone prevents a lot of reasonable layouts, like tables. Also problematic is a standards body that ignores this use case! In this case, they protect the writer from over-filling some boxes with more boxes. But that would at least be visible - in this case, the workarounds end up far worse.
> You can't specify the width of an inline element, for one. display: inline-block; width: ... ?