digitalmars.D - css minification
- Andrei Alexandrescu (8/8) Jan 16 2015 I just added
- Vladimir Panteleev (20/27) Jan 16 2015 I would advise against this. If added, it should be opt-in.
- Andrei Alexandrescu (32/57) Jan 16 2015 To counter that I was thinking of:
- H. S. Teoh via Digitalmars-d (24/36) Jan 16 2015 [...]
- Vladimir Panteleev (6/7) Jan 16 2015 http://yui.github.io/yuicompressor/
- Andrei Alexandrescu (5/10) Jan 16 2015 $ java
- Vladimir Panteleev (4/18) Jan 16 2015 No idea what that means. Google says it's a Mac problem.
- Andrei Alexandrescu (3/19) Jan 16 2015 That's why online services rok. Anyone knows of a secure css minimizing
- Vladimir Panteleev (5/29) Jan 16 2015 I could put one up in a few minutes. But I think it'd be better
- Adam D. Ruppe (16/18) Jan 16 2015 Minification in general is of dubious value, but doubly so with
- Vladimir Panteleev (11/15) Jan 16 2015 We (and a lot of other people) already trust GitHub. Also, GitHub
- Andrei Alexandrescu (3/3) Jan 16 2015 On 1/16/15 9:58 AM, Vladimir Panteleev wrote:
- H. S. Teoh via Digitalmars-d (5/9) Jan 16 2015 Thanks!!
- Andrei Alexandrescu (3/9) Jan 16 2015 Glad it works for you. Vladimir, is opt-in okay with you as a first step...
- Vladimir Panteleev (7/18) Jan 16 2015 I do not build the documentation often, so my post was an attempt
- Steven Schveighoffer (4/11) Jan 16 2015 Almost all browsers support gzip transfer of files. You'd get much
- Andrei Alexandrescu (4/16) Jan 16 2015 That's part of the protocol, right? We should be doing that anyway.
- Steven Schveighoffer (6/24) Jan 16 2015 I think this is way over-optimization.
- Andrei Alexandrescu (8/33) Jan 16 2015 Well good point. As of January two of the css files are in the top 3
- Vladimir Panteleev (12/15) Jan 16 2015 That's probably because HTTP caching is not configured.
- Andrei Alexandrescu (3/15) Jan 16 2015 Nice. Wanna take it up? Generally I'm looking for less work for me and
- Kiith-Sa (7/36) Jan 16 2015 Also, -1 for CSS minification, if I'll ever want to make any CSS
- Andrei Alexandrescu (3/6) Jan 16 2015 I'm estimating about one third of 12%, or 4% of the total traffic.
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (3/6) Jan 17 2015 You'd use the DOM inspectors in this case, no? They don't care
- Jacob Carlborg (4/7) Jan 17 2015 Or a hash of the file content in the filename.
- Mengu (4/4) Jan 17 2015 don't know if it's already said but if you are using nginx,
- Andrei Alexandrescu (5/10) Jan 17 2015 Opt-in is fine. Please review and pull:
- Steven Schveighoffer (11/46) Jan 16 2015 Well, this is looking at the wrong statistic. I don't care how much of
- Andrei Alexandrescu (2/4) Jan 16 2015 30% -- ANDREI
- Steven Schveighoffer (3/7) Jan 16 2015 so d-minified.css.gz is 30% smaller than d.css.gz? Just want to clarify.
- Vladimir Panteleev (6/16) Jan 16 2015 Original Minified
- Andrei Alexandrescu (3/18) Jan 16 2015 So then the two optimizations don't compete. I hate it when I'm right
- Steven Schveighoffer (6/27) Jan 16 2015 If the CSS isn't frequently changing, a 4kb file should not comprise 5%
- Andrei Alexandrescu (2/4) Jan 16 2015 May be a sign we have lots of new visitors :o). -- Andrei
- Andrei Alexandrescu (3/10) Jan 16 2015 No, I didn't do any compression. Please do it and beat me over the head
- Andrei Alexandrescu (12/17) Jan 16 2015 Pretty cool. The problem I'm having right now is the following pattern:
- Steven Schveighoffer (13/27) Jan 16 2015 At the cost of adding dependencies for builds, and requiring builds be
- Andrei Alexandrescu (3/10) Jan 16 2015 The more involved part is figuring out what support is out there for
- Steven Schveighoffer (6/18) Jan 16 2015 Right, I understand. I'm not in a position to actually make those
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (15/56) Jan 17 2015 Why do we need an external services?
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (7/7) Jan 17 2015 Another cheap addition, down to 11577 bytes:
- Andrei Alexandrescu (3/35) Jan 17 2015 Would be a nice tools/ thing. Wanna do it/ --- Andrei
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (8/9) Jan 18 2015 First try:
- Andrei Alexandrescu (5/13) Jan 18 2015 Noice. Would be interesting to see how much Brian's lexer generator
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (5/26) Jan 18 2015 It might help, maybe I'll try it out (not today, though). One
- Kiith-Sa (9/9) Jan 16 2015 I looked at the favicon, and...
- Andrei Alexandrescu (3/12) Jan 16 2015 Thanks. Could you please Just Do It(tm) or paste this into a bug report....
- Rikki Cattermole (4/12) Jan 16 2015 For reference, Cmsed has a port of a css/javascript minifier.
- Steven Schveighoffer (3/18) Jan 16 2015 Just googled it. For further reading: https://github.com/rikkimax/Cmsed
- Sebastiaan Koppe (64/72) Jan 17 2015 I have taken a look at http://dlang.org and assessed some of the
- Andrei Alexandrescu (22/96) Jan 17 2015 Measurements contradict that. Anyhow my point was one line of code
- Sebastiaan Koppe (38/95) Jan 17 2015 Wait, one step back. I was still in assessment mode. I haven't
- Andrei Alexandrescu (14/63) Jan 17 2015 Forwarded to our webmaster, thanks.
- Andrei Alexandrescu (3/5) Jan 17 2015 Our webmaster got back. He said compression is more CPU work and on a
- H. S. Teoh via Digitalmars-d (5/11) Jan 17 2015 +1 for dogfooding!
- Adam D. Ruppe (25/29) Jan 17 2015 Doing it on demand might be a mistake here, but we can also
- Adam D. Ruppe (8/8) Jan 17 2015 On second thought this way works better:
- Andrei Alexandrescu (2/8) Jan 17 2015 Who's "you"? :o) -- Andrei
- Adam D. Ruppe (35/36) Jan 17 2015 I'd do it myself, but after spending 30 minutes tonight trying
- Sebastiaan Koppe (7/14) Jan 17 2015 If you do not have spare horsepower for compression, how will you
- Andrei Alexandrescu (2/12) Jan 17 2015 Not quite getting the logic there. -- Andrei
- Sebastiaan Koppe (16/31) Jan 18 2015 It is unrelated to my point about compression. The reasoning is
- Andrei Alexandrescu (3/18) Jan 18 2015 We're not maxed out on resources. The question was whether compression
- Andrei Alexandrescu (4/7) Jan 18 2015 Urgh, typo.
- Andrei Alexandrescu (5/12) Jan 18 2015 Much of that was to enable running D code in the browser, which has been...
- Sebastiaan Koppe (20/44) Jan 17 2015 2 things:
- Jacob Carlborg (5/11) Jan 18 2015 Was that honest? I got the impression that you and Walter was satisfied
I just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts? Andrei
Jan 16 2015
On Friday, 16 January 2015 at 17:40:40 UTC, Andrei Alexandrescu wrote:I just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts?I would advise against this. If added, it should be opt-in. I see the following issues: - The service in question might be occasionally down, or might be shut down completely at some point. This makes it an additional point of failure. - High website load or poor Internet speeds will increase the time needed to build the website. - We can't know for sure that at some point the owners of cssminifier.com won't decide to inject evil code in the output. Even if you trust the owners, the service might get hacked with the same outcome. - As the request goes over HTTP, you also need to trust every peer between your machine and the website to not perform a MITM attack. I think relying on a random 3rd-party service is acceptable for an amateur or hobbyist website, which we are not. Instead, I suggest adding an optional (opt-in) rule which invokes an offline CSS minifier.
Jan 16 2015
On 1/16/15 9:58 AM, Vladimir Panteleev wrote:On Friday, 16 January 2015 at 17:40:40 UTC, Andrei Alexandrescu wrote:Thanks for the feedback.I just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts?I would advise against this. If added, it should be opt-in.I see the following issues: - The service in question might be occasionally down, or might be shut down completely at some point. This makes it an additional point of failure.To counter that I was thinking of: curl -X POST -s --data-urlencode 'input $<' http://cssminifier.com/raw$ || cp $< $This is nice modulo possible delays due to slow timeouts. I should also add that we already connect online to fetch LATEST from github. Incidentally today that takes forever :o).- High website load or poor Internet speeds will increase the time needed to build the website.Actually that's not the case in my experience. Did you build the site recently, i.e. with dub in tow? Build time is dominated by running dub, and it's impossible to run it on only the modified portions of the site. make -j on my laptop takes one full minute without doing anything online. Running a few curls in parallel with that have plenty of time to finish. Then dub generates 286 MB worth of stuff, which takes a long time to rsync. (For perspective: the pre-dub site, images and all, was 19 MB.) I'm not sure whether rsync gets further confused by the necessity of wiping all files and generating them again, whether they're identical or not. I confess I'm unhappy with dub. I was hoping for a turnkey solution that also opens up new possibilities. Sadly it adds its own problems, and those it solves I know how to do simpler with ddoc and tooling around it. As things are, I found myself with another project in my lap that I need to babysit.- We can't know for sure that at some point the owners of cssminifier.com won't decide to inject evil code in the output. Even if you trust the owners, the service might get hacked with the same outcome.Good point. We could, of course, store the converted css and inspect it before uploading, but seems a bit like meteor insurance to me.- As the request goes over HTTP, you also need to trust every peer between your machine and the website to not perform a MITM attack. I think relying on a random 3rd-party service is acceptable for an amateur or hobbyist website, which we are not. Instead, I suggest adding an optional (opt-in) rule which invokes an offline CSS minifier.That's a rather dim view of online services :o). What would be a trustworty offline CSS minifier? Overall I'm unconvinced of your arguments and I think we should move forward with https://github.com/D-Programming-Language/dlang.org/pull/770 or a variation thereof. Andrei
Jan 16 2015
On Fri, Jan 16, 2015 at 10:16:55AM -0800, Andrei Alexandrescu via Digitalmars-d wrote:On 1/16/15 9:58 AM, Vladimir Panteleev wrote:[...] I also advise against this. I do run documentation builds a lot when working on PRs -- to verify the generated docs are satisfactory, for example. Sometimes I work on PRs when I don't have a network connection. It would really, *really* suck if I can't do any useful work unless I have a stable connection. (Not to mention, sometimes I have to work behind firewalls, which can make otherwise reliable internet hosts unreliable.) Please make this opt-in. Otherwise I will really lose a lot of motivation to work on docs. It's already bad enough that the dlang.org repo depends on all sorts of external tools, like kindle, latex, etc., most of which I don't (immediately) care about. Fortunately, the 'html' target of the makefile allows me to successfully generate the HTML docs without installing all sorts of software that I otherwise never use. If you feel absolutely compelled to use an online minifier, can you at least make it possible to build the docs *without* it? And I mean a dedicated build target that bypasses that step completely; half-hearted hacks like waiting for the connection to timeout is not a viable option because it would just slow things down to the point I would probably just give up and throw away any doc contributions. T -- Nearly all men can stand adversity, but if you want to test a man's character, give him power. -- Abraham LincolnOn Friday, 16 January 2015 at 17:40:40 UTC, Andrei Alexandrescu wrote:I just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts?I would advise against this. If added, it should be opt-in.
Jan 16 2015
On Friday, 16 January 2015 at 18:16:55 UTC, Andrei Alexandrescu wrote:What would be a trustworty offline CSS minifier?http://yui.github.io/yuicompressor/ Its only dependency is Java. Usage: java -jar yuicompressor-*.jar --type css < input.css > output.css
Jan 16 2015
On 1/16/15 12:27 PM, Vladimir Panteleev wrote:On Friday, 16 January 2015 at 18:16:55 UTC, Andrei Alexandrescu wrote:$ java No Java runtime present, requesting install. $ _ AndreiWhat would be a trustworty offline CSS minifier?http://yui.github.io/yuicompressor/ Its only dependency is Java. Usage: java -jar yuicompressor-*.jar --type css < input.css > output.css
Jan 16 2015
On Friday, 16 January 2015 at 20:51:34 UTC, Andrei Alexandrescu wrote:On 1/16/15 12:27 PM, Vladimir Panteleev wrote:No idea what that means. Google says it's a Mac problem. I am neither a Java nor Mac person, sorry.On Friday, 16 January 2015 at 18:16:55 UTC, Andrei Alexandrescu wrote:$ java No Java runtime present, requesting install. $ _What would be a trustworty offline CSS minifier?http://yui.github.io/yuicompressor/ Its only dependency is Java. Usage: java -jar yuicompressor-*.jar --type css < input.css > output.css
Jan 16 2015
On 1/16/15 12:56 PM, Vladimir Panteleev wrote:On Friday, 16 January 2015 at 20:51:34 UTC, Andrei Alexandrescu wrote:That's why online services rok. Anyone knows of a secure css minimizing service? -- AndreiOn 1/16/15 12:27 PM, Vladimir Panteleev wrote:No idea what that means. Google says it's a Mac problem. I am neither a Java nor Mac person, sorry.On Friday, 16 January 2015 at 18:16:55 UTC, Andrei Alexandrescu wrote:$ java No Java runtime present, requesting install. $ _What would be a trustworty offline CSS minifier?http://yui.github.io/yuicompressor/ Its only dependency is Java. Usage: java -jar yuicompressor-*.jar --type css < input.css > output.css
Jan 16 2015
On Friday, 16 January 2015 at 21:04:58 UTC, Andrei Alexandrescu wrote:On 1/16/15 12:56 PM, Vladimir Panteleev wrote:I could put one up in a few minutes. But I think it'd be better if it was on dlang.org's servers. Now... does the server have Java installed? ;)On Friday, 16 January 2015 at 20:51:34 UTC, Andrei Alexandrescu wrote:That's why online services rok. Anyone knows of a secure css minimizing service? -- AndreiOn 1/16/15 12:27 PM, Vladimir Panteleev wrote:No idea what that means. Google says it's a Mac problem. I am neither a Java nor Mac person, sorry.On Friday, 16 January 2015 at 18:16:55 UTC, Andrei Alexandrescu wrote:$ java No Java runtime present, requesting install. $ _What would be a trustworty offline CSS minifier?http://yui.github.io/yuicompressor/ Its only dependency is Java. Usage: java -jar yuicompressor-*.jar --type css < input.cssoutput.css
Jan 16 2015
On Friday, 16 January 2015 at 21:04:58 UTC, Andrei Alexandrescu wrote:That's why online services rok. Anyone knows of a secure css minimizing service? -- AndreiMinification in general is of dubious value, but doubly so with css, it barely makes a difference compared to gzip and client side caching. If comments are a problem, just write a little regex thingy to strip them out. You could do the same to leading and trailing whitespace on a line, though that's really negligible too. Or, you could use something like my css macro expand which transforms css in a useful way and strips out comments in the process. .foo { .nesting-supported-with-css-expand { } } http://code.dlang.org/packages/cssexpand
Jan 16 2015
On Friday, 16 January 2015 at 18:16:55 UTC, Andrei Alexandrescu wrote:I should also add that we already connect online to fetch LATEST from github. Incidentally today that takes forever :o).We (and a lot of other people) already trust GitHub. Also, GitHub is HTTPS-only.That's a rather dim view of online services :o).This is not so much about online services in general, but more about online services created by some random guy which process code that will end up on our website. If the website was created by a generally trusted organization, transferred data securely, and/or operated on e.g. plain text, then some of my points would not apply.What would be a trustworty offline CSS minifier?FWIW, YUI compressor is what I use for DFeed.
Jan 16 2015
On 1/16/15 9:58 AM, Vladimir Panteleev wrote: [snip] Just made css minification opt-in. -- Andrei
Jan 16 2015
On Fri, Jan 16, 2015 at 10:37:38AM -0800, Andrei Alexandrescu via Digitalmars-d wrote:On 1/16/15 9:58 AM, Vladimir Panteleev wrote: [snip] Just made css minification opt-in. -- AndreiThanks!! T -- "Maybe" is a strange word. When mom or dad says it it means "yes", but when my big brothers say it it means "no"! -- PJ jr.
Jan 16 2015
On 1/16/15 10:40 AM, H. S. Teoh via Digitalmars-d wrote:On Fri, Jan 16, 2015 at 10:37:38AM -0800, Andrei Alexandrescu via Digitalmars-d wrote:Glad it works for you. Vladimir, is opt-in okay with you as a first step toward a more secure solution? -- AndreiOn 1/16/15 9:58 AM, Vladimir Panteleev wrote: [snip] Just made css minification opt-in. -- AndreiThanks!!
Jan 16 2015
On Friday, 16 January 2015 at 20:40:29 UTC, Andrei Alexandrescu wrote:On 1/16/15 10:40 AM, H. S. Teoh via Digitalmars-d wrote:I do not build the documentation often, so my post was an attempt at advice from experience rather than an objection based on personal motives. Generally, and as I mentioned at the top of my post, I think opt-in is acceptable, as the default no longer has risks of security or unexpected failure.On Fri, Jan 16, 2015 at 10:37:38AM -0800, Andrei Alexandrescu via Digitalmars-d wrote:Glad it works for you. Vladimir, is opt-in okay with you as a first step toward a more secure solution? -- AndreiOn 1/16/15 9:58 AM, Vladimir Panteleev wrote: [snip] Just made css minification opt-in. -- AndreiThanks!!
Jan 16 2015
On 1/16/15 12:40 PM, Andrei Alexandrescu wrote:I just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts?Almost all browsers support gzip transfer of files. You'd get much better mileage with just gzipping the file. -Steve
Jan 16 2015
On 1/16/15 12:37 PM, Steven Schveighoffer wrote:On 1/16/15 12:40 PM, Andrei Alexandrescu wrote:That's part of the protocol, right? We should be doing that anyway. Anyhow, the css is really hot and comments just add to it, compressed or not. -- AndreiI just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts?Almost all browsers support gzip transfer of files. You'd get much better mileage with just gzipping the file. -Steve
Jan 16 2015
On 1/16/15 3:53 PM, Andrei Alexandrescu wrote:On 1/16/15 12:37 PM, Steven Schveighoffer wrote:I think this is way over-optimization. If the system already sends gzipped, I don't think any kind of minification is going to improve enough to the point of justifying all this. (Dons Walter hat): have you profiled to see how much it saves? -SteveOn 1/16/15 12:40 PM, Andrei Alexandrescu wrote:That's part of the protocol, right? We should be doing that anyway. Anyhow, the css is really hot and comments just add to it, compressed or not. -- AndreiI just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts?Almost all browsers support gzip transfer of files. You'd get much better mileage with just gzipping the file. -Steve
Jan 16 2015
On 1/16/15 1:13 PM, Steven Schveighoffer wrote:On 1/16/15 3:53 PM, Andrei Alexandrescu wrote:Well good point. As of January two of the css files are in the top 3 most trafficked files off of dlang.org, second only to favicon.ico. Loading css accounts for 12.78% of all dlang.org hits and 5.73% of all dlang.org bytes transferred. I'd say improvements would be measurable. of all hits and 16.27% of all bytes transferred. AndreiOn 1/16/15 12:37 PM, Steven Schveighoffer wrote:I think this is way over-optimization. If the system already sends gzipped, I don't think any kind of minification is going to improve enough to the point of justifying all this. (Dons Walter hat): have you profiled to see how much it saves?On 1/16/15 12:40 PM, Andrei Alexandrescu wrote:That's part of the protocol, right? We should be doing that anyway. Anyhow, the css is really hot and comments just add to it, compressed or not. -- AndreiI just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts?Almost all browsers support gzip transfer of files. You'd get much better mileage with just gzipping the file. -Steve
Jan 16 2015
On Friday, 16 January 2015 at 21:26:04 UTC, Andrei Alexandrescu wrote:Well good point. As of January two of the css files are in the top 3 most trafficked files off of dlang.org, second only to favicon.ico.That's probably because HTTP caching is not configured. Ideally, you'd put the file's modification time in its path, e.g.: <link rel="stylesheet" type="text/css" href="css/1421443851/style.css" /> css/*/style.css would point to the same style.css (via internal, not HTTP redirect). Then, css/* can be cached forever, as the URL of the file would change when the file changes. This is what DFeed does, but I'm not sure if this is feasible with just DDoc and makefiles, though.
Jan 16 2015
On 1/16/15 1:32 PM, Vladimir Panteleev wrote:On Friday, 16 January 2015 at 21:26:04 UTC, Andrei Alexandrescu wrote:Nice. Wanna take it up? Generally I'm looking for less work for me and more work for others :o). -- AndreiWell good point. As of January two of the css files are in the top 3 most trafficked files off of dlang.org, second only to favicon.ico.That's probably because HTTP caching is not configured. Ideally, you'd put the file's modification time in its path, e.g.: <link rel="stylesheet" type="text/css" href="css/1421443851/style.css" /> css/*/style.css would point to the same style.css (via internal, not HTTP redirect). Then, css/* can be cached forever, as the URL of the file would change when the file changes. This is what DFeed does, but I'm not sure if this is feasible with just DDoc and makefiles, though.
Jan 16 2015
On Friday, 16 January 2015 at 21:39:52 UTC, Andrei Alexandrescu wrote:On 1/16/15 1:32 PM, Vladimir Panteleev wrote:Also, -1 for CSS minification, if I'll ever want to make any CSS contibutions I'll start by looking at the CSS in the browser. +1 for gzip and caching. *don't even consider* microoptimizations like this if you're not even doing that yet, whatever gains you might get are negligible by comparison.On Friday, 16 January 2015 at 21:26:04 UTC, Andrei Alexandrescu wrote:Nice. Wanna take it up? Generally I'm looking for less work for me and more work for others :o). -- AndreiWell good point. As of January two of the css files are in the top 3 most trafficked files off of dlang.org, second only to favicon.ico.That's probably because HTTP caching is not configured. Ideally, you'd put the file's modification time in its path, e.g.: <link rel="stylesheet" type="text/css" href="css/1421443851/style.css" /> css/*/style.css would point to the same style.css (via internal, not HTTP redirect). Then, css/* can be cached forever, as the URL of the file would change when the file changes. This is what DFeed does, but I'm not sure if this is feasible with just DDoc and makefiles, though.
Jan 16 2015
On 1/16/15 2:02 PM, Kiith-Sa wrote:+1 for gzip and caching. *don't even consider* microoptimizations like this if you're not even doing that yet, whatever gains you might get are negligible by comparison.I'm estimating about one third of 12%, or 4% of the total traffic. That's a hell of a ROI for one line of code. -- Andrei
Jan 16 2015
On Friday, 16 January 2015 at 22:02:27 UTC, Kiith-Sa wrote:Also, -1 for CSS minification, if I'll ever want to make any CSS contibutions I'll start by looking at the CSS in the browser.You'd use the DOM inspectors in this case, no? They don't care about the formatting of the CSS file.
Jan 17 2015
On 2015-01-16 22:32, Vladimir Panteleev wrote:That's probably because HTTP caching is not configured. Ideally, you'd put the file's modification time in its path, e.g.: <link rel="stylesheet" type="text/css" href="css/1421443851/style.css" />Or a hash of the file content in the filename. -- /Jacob Carlborg
Jan 17 2015
don't know if it's already said but if you are using nginx, there's a plugin for minification and builtin support for compressing html pages or static assets. therefore, nobody needs a third-party dependency for building the docs.
Jan 17 2015
On 1/17/15 4:58 AM, Mengu wrote:don't know if it's already said but if you are using nginx,We use Apache as far as I know.there's a plugin for minification and builtin support for compressing html pages or static assets. therefore, nobody needs a third-party dependency for building the docs.Opt-in is fine. Please review and pull: https://github.com/D-Programming-Language/dlang.org/pull/770 Andrei
Jan 17 2015
On 1/16/15 4:26 PM, Andrei Alexandrescu wrote:On 1/16/15 1:13 PM, Steven Schveighoffer wrote:Well, this is looking at the wrong statistic. I don't care how much of the overall bandwidth it is, what I was asking is how much does the file shrink if you minify. Saving 1% file size isn't going to put any kind of dent in the traffic.On 1/16/15 3:53 PM, Andrei Alexandrescu wrote:Well good point. As of January two of the css files are in the top 3 most trafficked files off of dlang.org, second only to favicon.ico. Loading css accounts for 12.78% of all dlang.org hits and 5.73% of all dlang.org bytes transferred. I'd say improvements would be measurable.On 1/16/15 12:37 PM, Steven Schveighoffer wrote:I think this is way over-optimization. If the system already sends gzipped, I don't think any kind of minification is going to improve enough to the point of justifying all this. (Dons Walter hat): have you profiled to see how much it saves?On 1/16/15 12:40 PM, Andrei Alexandrescu wrote:That's part of the protocol, right? We should be doing that anyway. Anyhow, the css is really hot and comments just add to it, compressed or not. -- AndreiI just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts?Almost all browsers support gzip transfer of files. You'd get much better mileage with just gzipping the file. -Steveof all hits and 16.27% of all bytes transferred.On an embedded product we have with a dead-simple web server, there is terrible network performance. Adding gzip support saved way more than minification ever could. But the best performance improvement was to add caching support to the server. Both the browser and the server have to cooperate there. -Steve
Jan 16 2015
On 1/16/15 1:44 PM, Steven Schveighoffer wrote:I don't care how much of the overall bandwidth it is, what I was asking is how much does the file shrink if you minify.30% -- ANDREI
Jan 16 2015
On 1/16/15 5:12 PM, Andrei Alexandrescu wrote:On 1/16/15 1:44 PM, Steven Schveighoffer wrote:so d-minified.css.gz is 30% smaller than d.css.gz? Just want to clarify. -SteveI don't care how much of the overall bandwidth it is, what I was asking is how much does the file shrink if you minify.30% -- ANDREI
Jan 16 2015
On Friday, 16 January 2015 at 22:17:51 UTC, Steven Schveighoffer wrote:On 1/16/15 5:12 PM, Andrei Alexandrescu wrote:Original Minified Uncompressed 16028 11959 gzip -9 4252 3194 Looks closer to 25%, but same ballpark.On 1/16/15 1:44 PM, Steven Schveighoffer wrote:so d-minified.css.gz is 30% smaller than d.css.gz? Just want to clarify. -SteveI don't care how much of the overall bandwidth it is, what I was asking is how much does the file shrink if you minify.30% -- ANDREI
Jan 16 2015
On 1/16/15 2:26 PM, Vladimir Panteleev wrote:On Friday, 16 January 2015 at 22:17:51 UTC, Steven Schveighoffer wrote:So then the two optimizations don't compete. I hate it when I'm right :o). -- AndreiOn 1/16/15 5:12 PM, Andrei Alexandrescu wrote:Original Minified Uncompressed 16028 11959 gzip -9 4252 3194 Looks closer to 25%, but same ballpark.On 1/16/15 1:44 PM, Steven Schveighoffer wrote:so d-minified.css.gz is 30% smaller than d.css.gz? Just want to clarify. -SteveI don't care how much of the overall bandwidth it is, what I was asking is how much does the file shrink if you minify.30% -- ANDREI
Jan 16 2015
On 1/16/15 5:30 PM, Andrei Alexandrescu wrote:On 1/16/15 2:26 PM, Vladimir Panteleev wrote:If the CSS isn't frequently changing, a 4kb file should not comprise 5% of all traffic if caching is enabled. I certainly think this is well worth the optimization, though, 25% is a good improvement. -SteveOn Friday, 16 January 2015 at 22:17:51 UTC, Steven Schveighoffer wrote:So then the two optimizations don't compete. I hate it when I'm right :o). -- AndreiOn 1/16/15 5:12 PM, Andrei Alexandrescu wrote:Original Minified Uncompressed 16028 11959 gzip -9 4252 3194 Looks closer to 25%, but same ballpark.On 1/16/15 1:44 PM, Steven Schveighoffer wrote:so d-minified.css.gz is 30% smaller than d.css.gz? Just want to clarify. -SteveI don't care how much of the overall bandwidth it is, what I was asking is how much does the file shrink if you minify.30% -- ANDREI
Jan 16 2015
On 1/16/15 2:35 PM, Steven Schveighoffer wrote:If the CSS isn't frequently changing, a 4kb file should not comprise 5% of all traffic if caching is enabled.May be a sign we have lots of new visitors :o). -- Andrei
Jan 16 2015
On 1/16/15 2:17 PM, Steven Schveighoffer wrote:On 1/16/15 5:12 PM, Andrei Alexandrescu wrote:No, I didn't do any compression. Please do it and beat me over the head with your pull request. -- AndreiOn 1/16/15 1:44 PM, Steven Schveighoffer wrote:so d-minified.css.gz is 30% smaller than d.css.gz? Just want to clarify.I don't care how much of the overall bandwidth it is, what I was asking is how much does the file shrink if you minify.30% -- ANDREI
Jan 16 2015
On 1/16/15 1:44 PM, Steven Schveighoffer wrote:On an embedded product we have with a dead-simple web server, there is terrible network performance. Adding gzip support saved way more than minification ever could. But the best performance improvement was to add caching support to the server. Both the browser and the server have to cooperate there.Pretty cool. The problem I'm having right now is the following pattern: 1. I have a mini-idea that takes me minutes to implement and turns the ratchet in the right direction. 2. I post it here in the hope that others will build upon or come with better ideas. 3. I get feedback here that essentially demonstrates me that if I spent some hours or days on a small research project on a better idea, it would yield better results. I encourage anyone who has more expertise in this kind of stuff to help out with turning the mythical ratchet one tooth forward. Thanks! Andrei
Jan 16 2015
On 1/16/15 5:23 PM, Andrei Alexandrescu wrote:On 1/16/15 1:44 PM, Steven Schveighoffer wrote:At the cost of adding dependencies for builds, and requiring builds be done with Internet access. I don't think it's out of line to ask that if we are going to add extra build requirements, we should make sure it's really making decent progress.On an embedded product we have with a dead-simple web server, there is terrible network performance. Adding gzip support saved way more than minification ever could. But the best performance improvement was to add caching support to the server. Both the browser and the server have to cooperate there.Pretty cool. The problem I'm having right now is the following pattern: 1. I have a mini-idea that takes me minutes to implement and turns the ratchet in the right direction.2. I post it here in the hope that others will build upon or come with better ideas. 3. I get feedback here that essentially demonstrates me that if I spent some hours or days on a small research project on a better idea, it would yield better results.I think you misunderstand. We are not saying "do a research project", it takes seconds to gzip 2 files (the minified and not minified) and see the size difference. If it's super-significant, let's go for it! If you send me the minified file, I can test it for you. There doesn't need to be any research, but all the suggestions that have been provided have NOT required extra tools or dependencies. That is a significant difference. -Steve
Jan 16 2015
On 1/16/15 2:32 PM, Steven Schveighoffer wrote:I think you misunderstand. We are not saying "do a research project", it takes seconds to gzip 2 files (the minified and not minified) and see the size difference. If it's super-significant, let's go for it! If you send me the minified file, I can test it for you. There doesn't need to be any research, but all the suggestions that have been provided have NOT required extra tools or dependencies. That is a significant difference.The more involved part is figuring out what support is out there for compressed transfers, configuring the site, etc. --- Andrei
Jan 16 2015
On 1/16/15 5:58 PM, Andrei Alexandrescu wrote:On 1/16/15 2:32 PM, Steven Schveighoffer wrote:Right, I understand. I'm not in a position to actually make those changes or support those servers, so I'll shut up. I was just saying my experience with what works and what doesn't with optimizing web traffic. -SteveI think you misunderstand. We are not saying "do a research project", it takes seconds to gzip 2 files (the minified and not minified) and see the size difference. If it's super-significant, let's go for it! If you send me the minified file, I can test it for you. There doesn't need to be any research, but all the suggestions that have been provided have NOT required extra tools or dependencies. That is a significant difference.The more involved part is figuring out what support is out there for compressed transfers, configuring the site, etc. --- Andrei
Jan 16 2015
On Friday, 16 January 2015 at 22:32:07 UTC, Steven Schveighoffer wrote:On 1/16/15 5:23 PM, Andrei Alexandrescu wrote:Why do we need an external services? cat style.css | tr '\n' ' ' | sed 's/\/\*[^*]*\*\///g' | sed 's/\s\+/ /g' | sed 's/ \?\([(){},;]\) \?/\1/g Strictly speaking, this is overzealous (e.g. it also operates inside strings), and I didn't even test it, but it will probably work for almost all cases. The current main CSS file of dlang.org (style.css) shrinks from 14757 to 11720 bytes, a reduction of ~21%. But even writing a compressor in D should be trivial, as you'd only need a lexer.On 1/16/15 1:44 PM, Steven Schveighoffer wrote:At the cost of adding dependencies for builds, and requiring builds be done with Internet access. I don't think it's out of line to ask that if we are going to add extra build requirements, we should make sure it's really making decent progress.On an embedded product we have with a dead-simple web server, there is terrible network performance. Adding gzip support saved way more than minification ever could. But the best performance improvement was to add caching support to the server. Both the browser and the server have to cooperate there.Pretty cool. The problem I'm having right now is the following pattern: 1. I have a mini-idea that takes me minutes to implement and turns the ratchet in the right direction.2. I post it here in the hope that others will build upon or come with better ideas. 3. I get feedback here that essentially demonstrates me that if I spent some hours or days on a small research project on a better idea, it would yield better results.I think you misunderstand. We are not saying "do a research project", it takes seconds to gzip 2 files (the minified and not minified) and see the size difference. If it's super-significant, let's go for it! If you send me the minified file, I can test it for you. There doesn't need to be any research, but all the suggestions that have been provided have NOT required extra tools or dependencies. That is a significant difference. -Steve
Jan 17 2015
Another cheap addition, down to 11577 bytes: cat style.css | tr '\n' ' ' | sed 's/\/\*[^*]*\*\///g' | sed 's/\s\+/ /g' | sed 's/ \?\([(){},;]\) \?/\1/g | sed 's/;}/}/g'
Jan 17 2015
On 1/17/15 8:44 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net>" wrote:On Friday, 16 January 2015 at 22:32:07 UTC, Steven Schveighoffer wrote:Would be a nice tools/ thing. Wanna do it/ --- AndreiOn 1/16/15 5:23 PM, Andrei Alexandrescu wrote:Why do we need an external services? cat style.css | tr '\n' ' ' | sed 's/\/\*[^*]*\*\///g' | sed 's/\s\+/ /g' | sed 's/ \?\([(){},;]\) \?/\1/g Strictly speaking, this is overzealous (e.g. it also operates inside strings), and I didn't even test it, but it will probably work for almost all cases. The current main CSS file of dlang.org (style.css) shrinks from 14757 to 11720 bytes, a reduction of ~21%. But even writing a compressor in D should be trivial, as you'd only need a lexer.On 1/16/15 1:44 PM, Steven Schveighoffer wrote:At the cost of adding dependencies for builds, and requiring builds be done with Internet access. I don't think it's out of line to ask that if we are going to add extra build requirements, we should make sure it's really making decent progress.On an embedded product we have with a dead-simple web server, there is terrible network performance. Adding gzip support saved way more than minification ever could. But the best performance improvement was to add caching support to the server. Both the browser and the server have to cooperate there.Pretty cool. The problem I'm having right now is the following pattern: 1. I have a mini-idea that takes me minutes to implement and turns the ratchet in the right direction.
Jan 17 2015
On Saturday, 17 January 2015 at 18:00:01 UTC, Andrei Alexandrescu wrote:Would be a nice tools/ thing. Wanna do it/ --- AndreiFirst try: https://github.com/schuetzm/shrinkcss/blob/master/shrinkcss.d Reads from stdin, writes to stdout. Removes comments, superfluous whitespace, and the closing ";" before "}". WARNING: This is mostly untested, the lexer is probably missing a few corner cases.
Jan 18 2015
On 1/18/15 9:41 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net>" wrote:On Saturday, 17 January 2015 at 18:00:01 UTC, Andrei Alexandrescu wrote:Noice. Would be interesting to see how much Brian's lexer generator would help. If it reduces size considerably or makes it a lot easier to do things, that would be a good proof of utility. -- AndreiWould be a nice tools/ thing. Wanna do it/ --- AndreiFirst try: https://github.com/schuetzm/shrinkcss/blob/master/shrinkcss.d Reads from stdin, writes to stdout. Removes comments, superfluous whitespace, and the closing ";" before "}". WARNING: This is mostly untested, the lexer is probably missing a few corner cases.
Jan 18 2015
On Sunday, 18 January 2015 at 17:46:52 UTC, Andrei Alexandrescu wrote:On 1/18/15 9:41 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net>" wrote:It might help, maybe I'll try it out (not today, though). One improvement I'd like to have would be to avoid the duplication of the `case`s of `lex()` in the `readXXX()` functions.On Saturday, 17 January 2015 at 18:00:01 UTC, Andrei Alexandrescu wrote:Noice. Would be interesting to see how much Brian's lexer generator would help. If it reduces size considerably or makes it a lot easier to do things, that would be a good proof of utility. -- AndreiWould be a nice tools/ thing. Wanna do it/ --- AndreiFirst try: https://github.com/schuetzm/shrinkcss/blob/master/shrinkcss.d Reads from stdin, writes to stdout. Removes comments, superfluous whitespace, and the closing ";" before "}". WARNING: This is mostly untested, the lexer is probably missing a few corner cases.
Jan 18 2015
I looked at the favicon, and... the file is .ico (bad format), stores 5 versions of the icon (16x16 to 64x64) even though only 16x16/32x32 are supported. Here are just the 16x16(383b) and 32x32(1.77kiB) versions, as PNGs (better compression than gif, and official standard - used RGBA, as 8-bit lost quality with almost identical size): pixel column from the 16x16 version because it was... 17x16. See http://www.w3.org/2005/10/howto-favicon
Jan 16 2015
On 1/16/15 1:54 PM, Kiith-Sa wrote:I looked at the favicon, and... the file is .ico (bad format), stores 5 versions of the icon (16x16 to 64x64) even though only 16x16/32x32 are supported. Here are just the 16x16(383b) and 32x32(1.77kiB) versions, as PNGs (better compression than gif, and official standard - used RGBA, as 8-bit lost quality with almost identical size): column from the 16x16 version because it was... 17x16. See http://www.w3.org/2005/10/howto-faviconThanks. Could you please Just Do It(tm) or paste this into a bug report. Thanks! -- Andrei
Jan 16 2015
On 17/01/2015 6:40 a.m., Andrei Alexandrescu wrote:I just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts? AndreiFor reference, Cmsed has a port of a css/javascript minifier. Feel free to extract it (its a subpackage so pretty easy). In fact I believe its one file.
Jan 16 2015
On 1/16/15 6:39 PM, Rikki Cattermole wrote:On 17/01/2015 6:40 a.m., Andrei Alexandrescu wrote:Just googled it. For further reading: https://github.com/rikkimax/Cmsed -SteveI just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts? AndreiFor reference, Cmsed has a port of a css/javascript minifier. Feel free to extract it (its a subpackage so pretty easy). In fact I believe its one file.
Jan 16 2015
On Friday, 16 January 2015 at 17:40:40 UTC, Andrei Alexandrescu wrote:I just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts? AndreiI have taken a look at http://dlang.org and assessed some of the improvements to be made. I will probably step on someones toes, sorry, but that is just because I have big feet. A lot of people have already said this, but minification is the last thing on the list. My browser needs to parse 299kb to display the page. Javascript alone takes up 210kb of that. 131kb of that is uncompressed. 33kb is jQuery and 33kb is widget.js. That widget.js thing is probably because of the twitter stream on the right. A seasoned JS programmer can rewrite that stuff in about 6kb, if not less. jQuery is the enabler of all bad habits; best to remove it quickly, if only because of principles. If you really got But codemirror-compressed.js and run.js are by far the worst contenders and should be addressed as first. You can bring down loading times to half (yes, you read that correctly, you can cut 150kb). Besides, do you really need 100+kb of codemirror JS? What is it even doing? Even if you really need it, why not compress the thing? It takes around 4 lines in apache conf to accomplish this. Give me SSH access and I'll do it in under 2 min. Caching is the next trick in the list. Remember that ISP's, proxy, etc. may also cache your files, not just browsers. These are the files that are referenced by http://dlang.org and are not using caching (nor compression!): dlang.org/ codemirror.css style.css print.css codemirror-compressed.js run-main-website.js run.js search-left.gif search-button.gif dlogo.png gradient-red.jpg search-bg.gif Next point on the list is bundling resources. The browser can only load some much stuff async. If you have too much, part of those resource are going to be blocked. Which basically means you have another round-trip + data that you have to wait for. While there are some other optimizations to be made - like putting that twitter stream js at the bottom of the page - the point is this: If I wanted to optimize this website, minifying style.css would be the last thing on my list. Besides, minimizing CSS is tantamount to removing comments and whitespace. Like Adam Ruppe said, a regex program in D can accomplish that; no need to use a online service. It probably takes you more time to integrate the online service than to write the D program including the regex. At the end of the day, watching `mb-downloaded per resource per total` tells you nothing. What only matter is the time it takes for users to enter `http://dlang.org` in the browser, up until the time they get to see something they can click on. Being among this group of knowledgeable programmers it amazes me this site is still pre 2000. I for one, am required to use Lynx just because my eyes can't stand the design. OT: And lets be honest here, why the hell do we even use apache+php and not D+vibe.d? I just rewrote my companies corporate website in under 4 hours. Granted, it is a simple one. But this community should be able to rewrite this site in D in under a week, right?
Jan 17 2015
On 1/17/15 10:01 AM, Sebastiaan Koppe wrote:On Friday, 16 January 2015 at 17:40:40 UTC, Andrei Alexandrescu wrote:Fantastic.I just added https://github.com/D-Programming-Language/dlang.org/pull/770, which generates minified css files. This is because in the near future css files will become heftier (more documentation comments, more detailed styles etc). The disadvantage is that now one needs to be online to generate documentation. Thoughts? AndreiI have taken a look at http://dlang.org and assessed some of the improvements to be made. I will probably step on someones toes, sorry, but that is just because I have big feet.A lot of people have already said this, but minification is the last thing on the list.Measurements contradict that. Anyhow my point was one line of code reduces all site traffic by 5% - they call that a good day.My browser needs to parse 299kb to display the page. Javascript alone takes up 210kb of that. 131kb of that is uncompressed. 33kb is jQuery and 33kb is widget.js. That widget.js thing is probably because of the twitter stream on the right. A seasoned JS programmer can rewrite that stuff in about 6kb, if not less.Great. You forgot to link to your pull request :o).jQuery is the enabler of all bad habits; best to remove it quickly, if only because of principles. If you really got addicted to thatI'm not an expert or an ideologist in the area. It was added by others who obviously have a different opinion from yours.But codemirror-compressed.js and run.js are by far the worst contenders and should be addressed as first. You can bring down loading times to half (yes, you read that correctly, you can cut 150kb). Besides, do you really need 100+kb of codemirror JS? What is it even doing? Even if you really need it, why not compress the thing? It takes around 4 lines in apache conf to accomplish this. Give me SSH access and I'll do it in under 2 min.I'm working with our webmaster to create accounts for a few folks. For now you may want to send me what needs to be done and I'll take it with him. N.B. I vaguely recall I've tried that once but it was not possible for obscure reasons.Caching is the next trick in the list. Remember that ISP's, proxy, etc. may also cache your files, not just browsers. These are the files that are referenced by http://dlang.org and are not using caching (nor compression!): dlang.org/ codemirror.css style.css print.css codemirror-compressed.js run-main-website.js run.js search-left.gif search-button.gif dlogo.png gradient-red.jpg search-bg.gifWhere should these be cached? I don't understand.Next point on the list is bundling resources. The browser can only load some much stuff async. If you have too much, part of those resource are going to be blocked. Which basically means you have another round-trip + data that you have to wait for.Yah, we do a bunch of that stuff on facebook.com. It's significant work. Wanna have at it?While there are some other optimizations to be made - like putting that twitter stream js at the bottom of the page - the point is this: If I wanted to optimize this website, minifying style.css would be the last thing on my list.Yah, the problem is everything on your list is hypothetical and not done, whereas css minimization is actual and done. Big difference. Very big difference.Besides, minimizing CSS is tantamount to removing comments and whitespace. Like Adam Ruppe said, a regex program in D can accomplish that; no need to use a online service. It probably takes you more time to integrate the online service than to write the D program including the regex.Then do it.At the end of the day, watching `mb-downloaded per resource per total` tells you nothing. What only matter is the time it takes for users to enter `http://dlang.org` in the browser, up until the time they get to see something they can click on.Agreed.Being among this group of knowledgeable programmers it amazes me this site is still pre 2000. I for one, am required to use Lynx just because my eyes can't stand the design.Then improve it.OT: And lets be honest here, why the hell do we even use apache+php and not D+vibe.d? I just rewrote my companies corporate website in under 4 hours. Granted, it is a simple one. But this community should be able to rewrite this site in D in under a week, right?I wish. Andrei
Jan 17 2015
On Saturday, 17 January 2015 at 18:23:45 UTC, Andrei Alexandrescu wrote:On 1/17/15 10:01 AM, Sebastiaan Koppe wrote:Wait, one step back. I was still in assessment mode. I haven't committed to doing anything.A seasoned JS programmer can rewrite that stuff in about 6kb, if not less.Great. You forgot to link to your pull request :o).Well, then they should use http://zeptojs.com/jQuery is the enabler of all bad habits; best to remove it quickly, if only because of principles. If you really got addicted to thatI'm not an expert or an ideologist in the area. It was added by others who obviously have a different opinion from yours.I do not know the obscure reasons, but it should be as simple as: nano /etc/apache2/mods-enabled/deflate.conf <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/x-javascript application/javacript application/ecmascript AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/json </IfModule> I know I am imposing on somebodies else's work here, but compressing resources should really be done.why not compress the thing? It takes around 4 lines in apache conf to accomplish this. Give me SSH access and I'll do it in under 2 min.I'm working with our webmaster to create accounts for a few folks. For now you may want to send me what needs to be done and I'll take it with him. N.B. I vaguely recall I've tried that once but it was not possible for obscure reasons.In the browser. So that on a reload of the page, the browser, instead of making HTTP calls, uses it's cache.Caching is the next trick in the list. Remember that ISP's, proxy, etc. may also cache your files, not just browsers.Where should these be cached? I don't understand.Yes. Please. But the compression thing takes precedence.Next point on the list is bundling resources. The browser can only load some much stuff async. If you have too much, part of those resource are going to be blocked. Which basically means you have another round-trip + data that you have to wait for.Yah, we do a bunch of that stuff on facebook.com. It's significant work. Wanna have at it?True. If you can get a 4% difference by minimizing CSS, just do it. I am just saying you can do a lot better. Plus, I think with all the expertise around here, most of us who do web development, did this at one stage or the other.While there are some other optimizations to be made - like putting that twitter stream js at the bottom of the page - the point is this: If I wanted to optimize this website, minifying style.css would be the last thing on my list.Yah, the problem is everything on your list is hypothetical and not done, whereas css minimization is actual and done. Big difference. Very big difference.regex to select comments: /(\/\*[^(*\/)]+\*\/)/g regex to select whitespace: /(\s+)/g and then delete those. I know css minimizers do more, but if comments and whitespace is your issue, this does the trick.Besides, minimizing CSS is tantamount to removing comments and whitespace. Like Adam Ruppe said, a regex program in D can accomplish that; no need to use a online service. It probably takes you more time to integrate the online service than to write the D program including the regex.Then do it.Design is a *very* touchy issue. It is basically a matter of choice. Without a definite choice made, I won't waste my time improving it. The choice is very simple: keep it like it is, do what everybody else is doingBeing among this group of knowledgeable programmers it amazes me this site is still pre 2000. I for one, am required to use Lynx just because my eyes can't stand the design.Then improve it.
Jan 17 2015
On 1/17/15 12:00 PM, Sebastiaan Koppe wrote:On Saturday, 17 January 2015 at 18:23:45 UTC, Andrei Alexandrescu wrote:Of course. :o)On 1/17/15 10:01 AM, Sebastiaan Koppe wrote: I'm not an expert or an ideologist in the area. It was added by others who obviously have a different opinion from yours.Well, then they should use http://zeptojs.com/Forwarded to our webmaster, thanks.I do not know the obscure reasons, but it should be as simple as: nano /etc/apache2/mods-enabled/deflate.conf <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/x-javascript application/javacript application/ecmascript AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/json </IfModule> I know I am imposing on somebodies else's work here, but compressing resources should really be done.why not compress the thing? It takes around 4 lines in apache conf to accomplish this. Give me SSH access and I'll do it in under 2 min.I'm working with our webmaster to create accounts for a few folks. For now you may want to send me what needs to be done and I'll take it with him. N.B. I vaguely recall I've tried that once but it was not possible for obscure reasons.How do we improve that on our side?In the browser. So that on a reload of the page, the browser, instead of making HTTP calls, uses it's cache.Caching is the next trick in the list. Remember that ISP's, proxy, etc. may also cache your files, not just browsers.Where should these be cached? I don't understand.Awesome. Don't forget you said this.Yes. Please. But the compression thing takes precedence.Next point on the list is bundling resources. The browser can only load some much stuff async. If you have too much, part of those resource are going to be blocked. Which basically means you have another round-trip + data that you have to wait for.Yah, we do a bunch of that stuff on facebook.com. It's significant work. Wanna have at it?regex to select comments: /(\/\*[^(*\/)]+\*\/)/g regex to select whitespace: /(\s+)/g and then delete those.Tested PR or by the end of the day this will slide into obsolescence.Design is a *very* touchy issue. It is basically a matter of choice. Without a definite choice made, I won't waste my time improving it.It's clear that once in a while we need to change the design just because it's old. Also, there are a few VERY obvious design improvements that need be done and would be accepted in a heartbeat, but NOBODY is doing them. I'm not an expert in design but I can tell within a second whether I like one. Yet no PR is coming for improving the design.The choice is very simple: keep it like it is, do what everybody else is doingFalse choice. Andrei
Jan 17 2015
I know I am imposing on somebodies else's work here, but compressing resources should really be done.Our webmaster got back. He said compression is more CPU work and on a fat pipe (which we do have) that may make things actually worse. Also, how would this work if we switch to vibe.d? -- Andrei
Jan 17 2015
On Sat, Jan 17, 2015 at 12:52:29PM -0800, Andrei Alexandrescu via Digitalmars-d wrote:+1 for dogfooding! T -- Notwithstanding the eloquent discontent that you have just respectfully expressed at length against my verbal capabilities, I am afraid that I must unfortunately bring it to your attention that I am, in fact, NOT verbose.I know I am imposing on somebodies else's work here, but compressing resources should really be done.Our webmaster got back. He said compression is more CPU work and on a fat pipe (which we do have) that may make things actually worse. Also, how would this work if we switch to vibe.d? -- Andrei
Jan 17 2015
On Saturday, 17 January 2015 at 20:52:28 UTC, Andrei Alexandrescu wrote:Our webmaster got back. He said compression is more CPU work and on a fat pipe (which we do have) that may make things actually worse.Doing it on demand might be a mistake here, but we can also pre-compress the files since it is a static site. You just run gzip on the files then serve them up with the proper headers. here's a thing about doing it in apache http://stackoverflow.com/questions/75482/how-can-i-pre-compress-files-with-mod-deflate-in-apache-2-xAlso, how would this work if we switch to vibe.d? -- AndreiI don't know about vibe, but it is trivially simple in HTTP, so if it isn't supported there, it is probably a three (ish) line change. Caching is the same deal btw, just set the right header and you'll get a huge improvement. "Cache-control: max-age=36000" will cache it for ten hours, without even needing to change the urls. (Changing urls is nice because you can set it to cache forever and still get instantly visible updates to the user by changing the url, but we'd probably be fine with a cache update lag and it is simpler that way.) ETags are set right now and that does some caching, it could be improved further by adding the max-age bit tho. This is an apache config of some sort too. http://stackoverflow.com/questions/16750757/apache-set-max-age-or-expires-in-htaccess-for-directory though I don't agree it should be one year unless we're using different urls, we should do hours or days, but that's how it is done.
Jan 17 2015
On second thought this way works better: http://stackoverflow.com/questions/7509501/how-to-configure-mod-deflate-to-serve-gzipped-assets-prepared-with-assetsprecom though that's some ugly configuration, I hate apache. But I just tested that locally and it all worked from a variety of user agents. All I had to do was gzip the file and also keep a copy of the uncompressed version to server to the (very few btw... but popular - curl, by default, is one of them) UAs that don't handle receiving gzipped info.
Jan 17 2015
On 1/17/15 4:22 PM, Adam D. Ruppe wrote:On Saturday, 17 January 2015 at 20:52:28 UTC, Andrei Alexandrescu wrote:Who's "you"? :o) -- AndreiOur webmaster got back. He said compression is more CPU work and on a fat pipe (which we do have) that may make things actually worse.Doing it on demand might be a mistake here, but we can also pre-compress the files since it is a static site. You just run gzip on the files then serve them up with the proper headers.
Jan 17 2015
On Sunday, 18 January 2015 at 02:11:13 UTC, Andrei Alexandrescu wrote:Who's "you"? :o) -- AndreiI'd do it myself, but after spending 30 minutes tonight trying and failing to get the website to build on my computer again tonight, I'm out of time. It really isn't hard though with access to the html and .htaccess or something. I just slapped this on my this-week-in-d local thingy: .htaccess: RewriteEngine on RewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\b RewriteCond %{REQUEST_FILENAME}.gz -s RewriteRule ^(.+) $1.gz [L] <FilesMatch \.css\.gz$> ForceType text/css Header set Content-Encoding gzip </FilesMatch> <FilesMatch \.js\.gz$> ForceType text/javascript Header set Content-Encoding gzip </FilesMatch> <FilesMatch \.rss\.gz$> ForceType application/rss+xml Header set Content-Encoding gzip </FilesMatch> ExpiresActive on ExpiresDefault "access plus 1 days" Then ran $ for i in *.html *.css *.rss *.js; do gzip "$i"; zcat "$i.gz" > "$i"; done; (gzip replaces the original file so i just uncompressed it again after zipping with zcat. idk if there's a better way, the man page didn't give a quick answer so i just did it his way) and the headers look good now. So like if that can be done on dlang.org too it should hopefully do the trick.
Jan 17 2015
On Saturday, 17 January 2015 at 20:52:28 UTC, Andrei Alexandrescu wrote:If you do not have spare horsepower for compression, how will you handle twice the load? I have used vibe.d to fetch gzipped resources, it has all the deflate&inflate stuff, so delivering gzipped resources should be easy as flipping a switch.I know I am imposing on somebodies else's work here, but compressing resources should really be done.Our webmaster got back. He said compression is more CPU work and on a fat pipe (which we do have) that may make things actually worse. Also, how would this work if we switch to vibe.d? -- Andrei
Jan 17 2015
On 1/17/15 11:23 PM, Sebastiaan Koppe wrote:On Saturday, 17 January 2015 at 20:52:28 UTC, Andrei Alexandrescu wrote:Not quite getting the logic there. -- AndreiIf you do not have spare horsepower for compression, how will you handle twice the load?I know I am imposing on somebodies else's work here, but compressing resources should really be done.Our webmaster got back. He said compression is more CPU work and on a fat pipe (which we do have) that may make things actually worse. Also, how would this work if we switch to vibe.d? -- Andrei
Jan 17 2015
On Sunday, 18 January 2015 at 07:42:10 UTC, Andrei Alexandrescu wrote:On 1/17/15 11:23 PM, Sebastiaan Koppe wrote:It is unrelated to my point about compression. The reasoning is as follows: if you are maxed out on resources, you will have problems when the site gets more visitors. Compression can still help there. If the file is compressed the server needs to send less bytes, and can close the connection quicker. Pre-compression instead of doing on-demand, like Adam Ruppe said, will optimize it even more. Btw. I build the dlang.org site on my computer but the <script> links have an %0 in the src attribute. Then 5 min later I saw the same on dlang.org Funny thing is, all stuff is still functioning. Affirming my hunch that you can remove a lot of the js stuff. The site now loads in 124kb. Whoever put that %0 there, you just cut down the site from 300kb to 124kb. Nice Job!On Saturday, 17 January 2015 at 20:52:28 UTC, Andrei Alexandrescu wrote:Not quite getting the logic there. -- AndreiOur webmaster got back. He said compression is more CPU work and on a fat pipe (which we do have) that may make things actually worse. Also, how would this work if we switch to vibe.d? -- AndreiIf you do not have spare horsepower for compression, how will you handle twice the load?
Jan 18 2015
On 1/18/15 1:01 AM, Sebastiaan Koppe wrote:On Sunday, 18 January 2015 at 07:42:10 UTC, Andrei Alexandrescu wrote:We're not maxed out on resources. The question was whether compression adds a net benefit. -- AndreiOn 1/17/15 11:23 PM, Sebastiaan Koppe wrote:It is unrelated to my point about compression. The reasoning is as follows: if you are maxed out on resourcesOn Saturday, 17 January 2015 at 20:52:28 UTC, Andrei Alexandrescu wrote:Not quite getting the logic there. -- AndreiOur webmaster got back. He said compression is more CPU work and on a fat pipe (which we do have) that may make things actually worse. Also, how would this work if we switch to vibe.d? -- AndreiIf you do not have spare horsepower for compression, how will you handle twice the load?
Jan 18 2015
On 1/18/15 1:01 AM, Sebastiaan Koppe wrote:Btw. I build the dlang.org site on my computer but the <script> links have an %0 in the src attribute. Then 5 min later I saw the same on dlang.orgUrgh, typo. https://github.com/D-Programming-Language/dlang.org/commit/807d471e602c1d8e6eff671ab1fe94b20b2e5cf1 Andrei
Jan 18 2015
On 1/18/15 1:01 AM, Sebastiaan Koppe wrote:Btw. I build the dlang.org site on my computer but the <script> links have an %0 in the src attribute. Then 5 min later I saw the same on dlang.org Funny thing is, all stuff is still functioning. Affirming my hunch that you can remove a lot of the js stuff. The site now loads in 124kb. Whoever put that %0 there, you just cut down the site from 300kb to 124kb. Nice Job!Much of that was to enable running D code in the browser, which has been disabled as of late. No problem! I'll ask one of our many lieutenants to look into it :o). Andrei
Jan 18 2015
On Saturday, 17 January 2015 at 20:17:51 UTC, Andrei Alexandrescu wrote:On 1/17/15 12:00 PM, Sebastiaan Koppe wrote:2 things: a) Set the proper cache headers in the http response. b) Have a way to bust the cache if you have a new version of an resource. If you have both in-place, you can set the expires header to 1 year in the future. Then bust the cache every time you have a new version of the file.On Saturday, 17 January 2015 at 18:23:45 UTC, Andrei Alexandrescu wrote:How do we improve that on our side?On 1/17/15 10:01 AM, Sebastiaan Koppe wrote:In the browser. So that on a reload of the page, the browser, instead of making HTTP calls, uses it's cache.I won't.Awesome. Don't forget you said this.Yah, we do a bunch of that stuff on facebook.com. It's significant work. Wanna have at it?Yes. Please. But the compression thing takes precedence.If I may suggest, I would split up the site into a couple of sections. One for Introduction/About, one for Docs/Api, one for Blogs, one for Community/Forum. Which is basically what everybody else is doing. Just some random sites: http://facebook.github.io/react/ https://www.dartlang.org/Design is a *very* touchy issue. It is basically a matter of choice. Without a definite choice made, I won't waste my time improving it.It's clear that once in a while we need to change the design just because it's old. Also, there are a few VERY obvious design improvements that need be done and would be accepted in a heartbeat, but NOBODY is doing them.I'm not an expert in design but I can tell within a second whether I like one. Yet no PR is coming for improving the design.Then why not just make a list of sites that we like. And then design this site like those. It is what all the designers are doing.
Jan 17 2015
On 2015-01-17 19:23, Andrei Alexandrescu wrote:On 1/17/15 10:01 AM, Sebastiaan Koppe wrote:Was that honest? I got the impression that you and Walter was satisfied with using Ddoc for the website. -- /Jacob CarlborgAnd lets be honest here, why the hell do we even use apache+php and not D+vibe.d? I just rewrote my companies corporate website in under 4 hours. Granted, it is a simple one. But this community should be able to rewrite this site in D in under a week, right?I wish.
Jan 18 2015