Live data from Hacker News

Web frameworks are transforming from runtime libraries into optimizing compilers

tomdale.net

121–130 of 231 posts

Re: Web frameworks are transforming from runtime libraries into optimizing compilers

#121

Domain specific languages I suppose are the next cool aid. Or languages with a comprehensive macro system (like Elixir) can bridge the gap between these ways of thinking. This feels very frontend focused though - I'm wondering if there is a more holistic approach. I have an idea for a framework/project, that over web sockets, views the browser as a thin client for a server side representation; commands would be sent…

"I'm wondering if there is a more holistic approach."

The end game, once WebAssembly is fully integrated into the browser, is to expose the 3D API and/or a high-performance low-level 2D API (or both) and slowly, but surely, a "web browser" will become an environment where you download a full rendering engine for a website, written in an arbitrary language that has WebASM support, and in the end both DOM and JS will become merely another option, at which point IMHO neither of them will actually fare very well, excepting their substantial existing install base. Caching will make this feasible as most of the "long tail" isn't going to make their own engine, just use someone else's, and there aren't really all that many sites who can afford to write their own.

While I consider the forces pressing on the browser to virtually predestine this outcome, it is at least 10 years off.

(If it wasn't for the fact that Javascript is still not fast enough to pull this off, I think we'd already see more frameworks that do layout and ship down a lot more divs and such with hard-coded absolute positions, turning the browser into an environment where it simply puts text and images where the server tells it to, and stops doing all this expensive reflowing and layout. You can see on all kinds of sites the desire to do this on the part of web publishers. However, it is impossible to do this on the server side because you need access to font metrics (where you may not be able to force your own), screen size info, browser zoom level, and a whole bunch of other such things that make it impractical to do server-side in a whole bunch of ways. But JS is still at least ten times slower than native code here, plus would take an inevitable penalty accessing a lot of FFI code, so this is currently almost unthinkably infeasible on the client side.)

Re: Web frameworks are transforming from runtime libraries into optimizing compilers

#122
post #75

Domain specific languages I suppose are the next cool aid. Or languages with a comprehensive macro system (like Elixir) can bridge the gap between these ways of thinking. This feels very frontend focused though - I'm wondering if there is a more holistic approach. I have an idea for a framework/project, that over web sockets, views the browser as a thin client for a server side representation; commands would be sent…

N2O[0] does exactly that. You write your app in Erlang and the framework delivers the changes via websockets to the browser. You can even choose to have the changes computed in the browser through an Erlang -> Js bridge. Pretty cool. [0] https://github.com/synrc/n2o

This looks great, I'll try it out!

Re: Web frameworks are transforming from runtime libraries into optimizing compilers

#123
post #85

Earlier quoted context omitted.

We were already nerds for a few decades before the browser was invented.

And we (my generation) weren't! "View Source" is not the only way to start on your way to nerddom, but it is, or at least was at some point in time, an important one.

I find computer magazines and programming books more relevant, and those aren't going away.

Re: Web frameworks are transforming from runtime libraries into optimizing compilers

#124

Earlier quoted context omitted.

What is sad about this? Small sizes are nice but as a consumer I don't care much. If a larger file size means that apps can be produced easier then I have zero objections.

Because for many consumers, 40MB where it could be 4MB means e.g. 5 minutes of download instead of 30 seconds, or 4% of their data plan instead of 0.4%. And waste is kind of like honesty - if you are wasteful with this, you're probably wasteful with everything else. Like with storage usage, which is a hard constraint on anything but top-of-the-line mobile phones. Like with network usage. Like with energy usage , whic…

How do you know the 40MB download wasn't aggressively optimized down from 400MB? Equating larger file size with lower quality is presumptuous. Is there any known correlation? Equating larger file size with lower honesty seems dishonest to me.

Optimizing takes time, sometimes a lot of time. I know because I've spent a lot of time optimizing file sizes to fit on game consoles, taking xbox360 games over to the Wii for example. If you optimize aggressively when there's no strong need to, when consumers like the one you replied to don't really care, and wont' change their buying habits, you are prematurely optimizing. That's a significant waste of precious time (and money) for a developer.

We (humans) waste a lot of things that are much more important than people's data plans. Gasoline and food, for examples. Why haven't we reduced those 10x? It is possible.

Re: Web frameworks are transforming from runtime libraries into optimizing compilers

#125
post #41

Check Svelte out ( https://svelte.technology/ ). From the docs: "... rather than interpreting your application code at run time, your app is converted into ideal JavaScript at build time. That means you don't pay the performance cost of the framework's abstractions, or incur a penalty when your app first loads."

Svelte is quite appealing, especially for the "reusable widget" layer web development. But there are two areas where there's probably room for something else to swoop in: * Pervasively typed with TypeScript, written in TypeScript, completely first-class. (It is very easy to consume TypeScript base code from JavaScript, but tacking types onto something written without them almost always yields a much lesser experience…

Svelte does now offer an option to compile directly to web components, though it's experimental at this time. You could give StencilJS a go - it's web components through and through, and uses Typescript.

Re: Web frameworks are transforming from runtime libraries into optimizing compilers

#126
post #41

Check Svelte out ( https://svelte.technology/ ). From the docs: "... rather than interpreting your application code at run time, your app is converted into ideal JavaScript at build time. That means you don't pay the performance cost of the framework's abstractions, or incur a penalty when your app first loads."

Svelte is quite appealing, especially for the "reusable widget" layer web development. But there are two areas where there's probably room for something else to swoop in: * Pervasively typed with TypeScript, written in TypeScript, completely first-class. (It is very easy to consume TypeScript base code from JavaScript, but tacking types onto something written without them almost always yields a much lesser experience…

This is how we're approaching it with Stencil: https://stenciljs.com/

Re: Web frameworks are transforming from runtime libraries into optimizing compilers

#127
post #116

Earlier quoted context omitted.

It becomes relevant when one doesn't intentionally interpret it in the wrong level of Maslow's hierarchy.

Maslow ? You mean the guy behind the obsolete stuff ? Or the guy who let another one torture monkeys ? http://journals.sagepub.com/doi/abs/10.1177/135050849743004 https://en.wikipedia.org/wiki/Harry_Harlow

[deleted]

Re: Web frameworks are transforming from runtime libraries into optimizing compilers

#128

Whilst I am in favour of the optimisation of resources (and use these sources) we are willingly moving the "View Source" model to for profit entities like github. In the way the internet has evolved we really should look hard it the elephant in the room: the DOM is for documents - not for interfaces. IMHO optimisation for javascript is just a short term fad (hopefully) and browsers will adopt a more open approach to…

> If the whole community effort was spent creating a better UI/UX standard (a standard web front end) What do you mean by standard? HTML already has a UX/UI standard (technically standard and with some deviations in terms of design implementation depending on the browser). A is always a button and looks like a button in any browser. The problem is that it looks awful if you are not Stallman. Both Android and iOS have…

> Both Android and iOS have been improving and refining (visually!) their UI elements, but this has not been done in the web, basically because there isn't a huge company calling the shots behind it.

I don't know about the other browsers, but Firefox defaults to displaying buttons the same way the OS does, so any visual refinement is adopted automatically. Of course the majority of websites override this to get full control over the look, which I find to be quite superfluous in most cases. The text field I'm typing this in and the "reply" button below it work perfectly fine without any fancy styling.

Re: Web frameworks are transforming from runtime libraries into optimizing compilers

#129

Earlier quoted context omitted.

What is sad about this? Small sizes are nice but as a consumer I don't care much. If a larger file size means that apps can be produced easier then I have zero objections.

I had to upgrade my phone because it ran out of internal memory and I had to keep removing apps I valued, as they all grew in size. So bloat cost me real money. Just because you don't care doesn't mean others don't. This is one of my pet peeves. Developers building things on high spec machines with fantastic network connections. Your website is impossible for others to use as it is so slow and cumbersome but the devs…

Software has been increasing in size over time since the beginning of software. This will never change. It goes hand in hand with why hardware keeps getting bigger capacity too. I agree that some of it is bloat, but some of it is more features and content too. When the OS adds a little, and the libraries add a little, and the apps add a little, the downloads get more than a little bigger, but it can be a side-effect of everyone adding useful features at every level.

There will always be a hardware limit, so if you install apps up to your limit, you will eventually have to delete some of them, no matter how small the apps are and no matter how big your phone's memory capacity is. You can't entirely blame that on developers, it's your budget to deal with. You can buy a bigger phone or install fewer apps. I like to keep a good 20-30% of my memory free just so things I depend on have room to grow.

You also have the option to swap out apps continually. It'd be a pain in the ass for sure, but if the least important app on your phone that you had to delete is really one you couldn't live without, you have the option to delete something else and re-install it, and then swap back later.

Re: Web frameworks are transforming from runtime libraries into optimizing compilers

#130

Whilst I am in favour of the optimisation of resources (and use these sources) we are willingly moving the "View Source" model to for profit entities like github. In the way the internet has evolved we really should look hard it the elephant in the room: the DOM is for documents - not for interfaces. IMHO optimisation for javascript is just a short term fad (hopefully) and browsers will adopt a more open approach to…

I think the DOM, and really the web as a whole, is a really incredible experiment in blurring the lines between documents and interfaces, which really are just two arbitrary delineations of "what a computer can do".

So for example, the DOM is what enabled newspapers to come online, and now it's what's turning newspapers into interactive online narrative machines. I'm typing into a hybrid document-application right now.

Post reply on HN