New JavaScript techniques for rapid page loads
blog.chromium.org
blog.chromium.org
http://blog.chromium.org/2015/03/new-javascript-techniques-f...
ALL HAIL THE MIGHTY CHROMIUM.
#header-inner img {max-width: 100%;}
instead of "width: 100%" inside the css the image would scale down if the screen becomes smaller than the px width of the graphic, but still stays 100% of it's own px width when more space is available. So no ugly upscaling.
https://i.imgur.com/9TH3Al7.pngKind of funny from chrome blog running in Chrome or is it a little sad.
Edit ---- I guess mobile version in desktop causing problem kind of make sense I guess.
Another annoyance is that unless you specifically configure Google Analytics to ignore that parameter every blog post gets two sets of metrics, one for the desktop version, and one for mobile.
Does this mean developers will need to put in (additional) efforts to do cache invalidation when they've updated their code?
1) Changing the file name, so it's a completely new file to the browser and thus downloaded (usually by incrementing the version number, like myApp.1.0.1.js).
2) Setting different cache rules on the server for different file types. If the updates aren't critical, you can let the cache run it's course. So your cache rules could be 1 month for images, 1 day for HTML, and 1 hour for JS files.
Edit: looking at the plv8 code, it doesn't seem to create a new Isolate for every request. So I think for the same instance of PostgreSQL the in-memory cache should also hit.
Can you give a reference for that?
HTML5 Boilerplate, Yeoman's generator-webapp and Google's Web Starter Kit do not come with these script attributes OOTB.
EDIT: ha I just noticed your username. Maybe you can tell me why those projects don't come with async script tags?
This is why my script tags end up in the head now, because I want to place them before the CSS tags, and I want to fetch the CSS before the body starts being displayed.
I tend to use defer rather than async because I want the scripts to execute in the order I add them to the page, and only once the body has been fully constructed.
That said, if you have to support old browsers, make sure you research which ones support async/defer, and which ones have buggy implementations. caniuse.com is your friend.
[*] If I'm wrong with any of the above, please correct me. Just checked your profile and you seem well qualified to contradict me.
Funnily enough I was toying around with cross domain local storage and ways to cache javascript for this very purpose. Sadly I found the overhead was a bit too high for only first load benefits and the extra complexity didn't really help things either. In any case, nice to see something of this nature going into the browser directly.
Though one thing is even more surprising for me. I thought parsing was the easy/cheap part of the compilation process. Why would then streaming parsing be such a big deal or am I missing something? Specially with the additional complexity of parsing the html and layout/rendering I would have thought JS parsing would be a minuscule part. Can anyone enlighten me?
In other words, its not, that was kind of my point, however it is cool.
I suspect, the devs had to modularize / logically separate parsing from compiling / executing somewhat before they could complete the next phase (fro chrome 42) which is the script caching part: cached scripts won't need re-parsing before compilation/execution.
Oddly, the native applications rarely seem to have much impact unless it's doing a hard task, like video encoding.
To answer your question, I think that NoScript users tend to appreciate (and even expect) minimalism... consequently some get irritated when even a simple blog can't load without JS. I get the appeal of the minimalist, standards-adhering, machine-parseable website, but it's not a big source of emotion for me :P
I also suspect that a lot of people, like myself, still consider the WWW a linked document system rather than a fat client application terminal, we just want documents with links to other documents, and sometimes simple forms.
I've been a no-script user for 3 days. I'd say the experience is better until I hit a useful site that requires javascript - when this happens it takes one or two attempts to enable javascript properly.
I would not recommend it for people for people who do not like messing around with their browsers. However, I intend to stay with no-script because page loads are faster and incredibly little functionality is missing.
Using NoScript does not mean "functionality missing". It's just disabled by default - and personally, most of the time I find the "missing functionality" unnecessary, and in most of places where it's not I already have a whitelist entry in place.
HN works perfectly. Lots of pages even work better with NoScript, as it basically cuts a lot of bloat. If some don't, enabling JS is one click away.
Anyway, there are lots of pages which are kind of expected to not work correctly without JavaScript - and that's fine. But if for instance Hacker News wouldn't work in its current form without JS, that would be a valid thing to complain about, because there's absolutely no reason for that. There are even some pages that implement loading animation in JS in a way that when JS is disabled, the whole page is obstructed by loader that never disappears - and that's just reckless coding that should be fixed.
<sigh>
I'd still love to see some sort of byte code for the web though but I love the advancements still.
It just makes sense to me but I haven't seen anyone working on it just occasionally talking about it. So maybe it doesn't make sense to the people working on web browsers, I dunno.
Not sure why you need byte code for that. You could just have a relatively stable base JS standard as the common target, and then a more rapidly changing set of advanced/experimental JS features implemented through compilers for the resulting, enhanced, JS+extra features languages that compile back to base JS. Heck, you could do the same thing for lots of other, non-JS languages that compile to base JS. In fact, that's exactly what is done today.
Byte code isn't magic, its just another language you have to write an interpreter for -- just not a human-readable one.
I'm sure they thought of that, so I'm just curious. I suppose I could look through the Chromium source but I'm probably not actually smart enough to figure it out.
I'm not suggesting it's likely that this will be an issue, but it's a legitimate question to ask, as there's a long history of people managing to leverage a combination of flaws allowing them to write in a limited set of locations with different flaws allowing them trick some tool into executing what they manage to get written to disk.
That's already escaping from sandbox which most likely would cause much more troubles. In this way we can worry about absolutely anything ;)
Anyone has any resources he (or she) can recommend about writing faster, more efficient javascript? I'm not a developer, I learned javascript to hack some things together and obviously I taught myself awful practices, but I can't identify/change them.
Code review a great tool to learn great practices. Get your code reviewed by some good developer and work on the comments. Sometime code review comments are very personal views of commenter, but in general they can be very helpful.
You said that you taught yourself an awful practice. If you can identify a practice as awful, then probably you can fix it without help of anybody else by simply googling. In my opinion the real challenge is to identify a piece of code is awful or not. If you can identify, then probably it is much easier to correct that.
https://github.com/superherojs/superherojs/blob/gh-pages/ind...