Hacker Newsnew | past | comments | ask | show | jobs | submit | simscitizen's commentslogin

I do a lot of systems and perf work and have elicited similar responses from colleagues at times when debugging various issues.

The thing is that at least IME, these are exactly the type of bugs that LLMs are astonishingly good at debugging. I can think of multiple instances where I did indeed just feed a confusing bug report into Claude and it fairly quickly dumped out an extremely non-obvious explanation that would previously required someone having an extraordinary insight into the problem.

I for one don't think I have any technical moat left in terms of debugging even though less than a year ago I'd regard it as one of my calling cards. I'm sure there are even more skilled folks that still have a moat but I wouldn't bet on it lasting much longer.


Browsers are runtimes and webpages are apps. They just happen to be apps that are dynamically fetched over the network and are packaged as HTML/CSS/JS instead of as PE/ELF/Mach-O binaries.

Runtimes can have bugs or inefficiencies that cause them to use more memory than strictly necessary, but by and large most memory problems are the product of the apps (or webpages) themselves.


The view of web pages as apps and browsers as runtime environments/OSes is reasonable but in my opinion it even reinforces the idea that it should be the browser duty to contain bad behavior from web apps/pages. Browsers are well positioned to do so, as they know exactly which resources are used by each tab , and how those grow over time. Also browsers already treat web content as untrusted (sandboxing, isolation), so it would be a natural next step to extend that approach to resource usage. It would match how Operating Systems work, where it's the OS acting as an "arbiter", not the userland application.

I would love it if all the major browsers would agree on this. "Every tab is only allowed up to 100mb of memory, if a page needs more than that, optimize it." - Though a setting from the user to allow it for, say, online videogames or streaming sites or something, would be a good idea.

I remember when I was a Safari user, any instance of Slack I had open would get reloaded after 5 – 10 minutes with the message "this web page was reloaded because it was using two much memory", interrupting whatever I was doing.

My computer had many gigabytes of memory, so I always found this very annoying. Like, yes, Slack is a giant memory hog and that really sucks, but I can't exactly do anything about that.

Maybe Google would have the clout to actually enforce a memory limit like this, but I'm not sure whether anyone else does at this point. Apparently even Apple wasn't big enough.


Actually Safari is the only browser with that clout because it's the only one available on iOS and for some reason people still care about iPhones. If Google did this they'd probably just lose back to Firefox and Edge.

Using more RAM could be a permission request.

1. It would break a very large number of existing sites. 2. The vast majority of users aren’t able to make an informed decision. 3. Browsers already have heuristics to inform users about misbehaving tabs and suspend them. 4. It hurts performance. More pressure on gc, more cache thrashing

It’s all about the UI. The browser vendor could make the informed guess and say “we think this web page is using too many resources”. Certainly Google could ascertain this during its spidering. Browsers already have several similar interventions e.g. no https, script taking too long etc.

Regardless, if it improved the experience then it becomes like Firefox was in the beginning, and Chrome in the beginning, a better performing competitor about to eat market share.


Phrase it direct and accusatory. "This website is making your computer slow and wasting your battery. [That's fine] [Stop it]"

They got everyone to switch to https by putting a big red cross through http://


Why do you think none of the major browsers have already done this?

Agree, most people just want to visit a site and use it. Don't want to be bother with permission requests. You read the permission request the first 2, 3 times. Then just allow forever and you are back to the same scenario

I was thinking exactly the same. Either: You have a fixed setting per page, or you get on-demand pop-ups from your browser(!) that asks if it can use more memory for this page. It would become exhausting very quickly. The purpose of my question was to help the original asker if this was really a good idea. Imagine there was a fixed setting per page... and your online banking/brokerage website has a bug that causes 2x memory usage. Suddenly, the page stops running with an error from the browser: Out of memory. That would be so annoying.

Because users would have no idea what to do.

I think the Corvette once had a special key for driving with enhanced performance, or maybe the key had to be turned to another position, I don't remember which. That caused so many service calls that later 'Vettes dropped it. And in the case of the Corvette, we're already talking about an enthusiast community that ostensibly actually takes an interest. Not so with people who call their browser "the internet".


> Because users would have no idea what to do.

Agreed. Nice idea but it's too much.


None of the major browsers have done this because they are prisoners of web devs, and now completely ignore user satisfaction to drive developer satisfaction.

My web browser runs on my computer and should do what I tell it to. Nobody else, just me.

The minute someone releases a browser that works that way they'll have whatever money they want to charge me for it. For now even Firefox does all sorts of anti-consumer nonsense and enforces all sorts of client side 'rules' it never should have so webdevs can protect their "rights" at my expense.

In the early days of the internet this kind of made sense. People had the "if devs don't trust the internet nobody will use it" argument. Now I think it's time to say "If users can't trust their own computers they won't use them."

I'm tired of living in Sagans demon haunted world.


It is non trivial to determine if ressouces a site is using is reasonable or not. A web game may use lots of ressources and will crash if the OS suddenly decides to take some memory away.

Edge and Opera GX already have an option to limit RAM usage, it's called Resource controls.

I am not following the logic.

Say I write a static html page that loads a series of images down the page where one image will fit on your screen at any time. If the browser loads them all into memory at once without releasing the memory or maintains the a fully rendered virtual page out of sight, is that bloat the app or runtime fault?


Both.

Runtime can certainly be optimized, but the app can also virtualize or force unloading if it needs to.


I am just talking about a page that is something like a descriptive document for the browser to deal with, probably less than 500 bytes.

     <html>
     <body>
     <img...>
     <br>
     <img..>
      ...
      </body>
     </html>

Then the browser/runtime should optimize that as much as possible.

I suppose, sure, static webpages are closer to "documents" than "apps" and they should work well 'out of the box' without adding heaps of JS to optimize the browser's difficiencies.


If the static page is badly written and does not instruct the browser to use lazy loading (using the loading="lazy" attribute on the img tag) and the browser loads them all at the same time, is that a problem with the page or the browser?

The whole ecosystem.

Lazy loading for images was only introduced around 2019, not every website out there will have been updated since (and retroactively become “badly written”).

It is also not on by default, because the platform itself is too conservative and the implementation doesn’t allow zero breakage changes of defaults like that.

The tooling culture around HTML also isn’t such that you’d be prevented from deploying a site if you can use it but don’t, at least you’re not railroaded towards that.

Lazy should have been the implicit default and we should have gotten loading=“eager” instead. Same with having sane calendar controls, dropdown and collapsible controls, video controls so good we wouldn’t need vendor equivalents, light boxes for images and so on.


It's a difficult question because there are so many factors in dom/css that change the answer to 'is there a chance that the image should be rendered the next frame?' that it becomes really hard to implement a strategy for what content to offload to disk and when

If the runtime fails to load the offloaded data back in time there will be visible rendering artifacts so you really have to make sure your strategy is robust


> Browsers are runtimes and webpages are apps.

The internet was a better place when webpages were not seen as "apps."


Though I agree, I am grateful that services such as my banking and national insurance are available via the browser and do not require me to install their own apps on each device. I have no banking apps on my phone nor desktop, Firefox is my window to all those services. I can put my trust in Firefox, I would not put my trust in each outsourced app each for each service I use.

Back in the days we've had generic interfaces to banking, e.g. HBCI, and there were optimised apps from reputable companies written in actual programming languages that compiled into optimised code. Running on the actual operating system without any weird abstraction layer in between. And it all even worked with a few MEGAbytes of RAM. AND that one app could talk to ALL of your banks. (And if you didn't like that one app, there was another one with a similar feature set.)

> Browsers are runtimes and webpages are apps. Surprised to see that.

I've been championing this mind set for nearly 20 years now. The message was more clear in the Flash era, but once you realize that your webpage is an (/a desktop) application that only happen to live in a browser - it makes a lot of reasoning and designing a lot easier.


> I've been championing this mind set for nearly 20 years now.

I don't want to tell you you've wasted your time but it's fairly obvious that webpages are sometimes documents, sometimes apps and sometimes a hybrid between the two. For example, YouTube is clearly an app, but a webpage written predominantly in HTML and CSS is much more of a document than an app.


how do you define a document?

i'm not trying to be glib, i get what you mean, i just wonder if you have an actual criteria. I've been struggling with this from time to time over the years.


> how do you define a document?

I would say a contained set of words, sometimes accompanied by static visual data (e.g. images), which aimed to convey ideas or information.

For example, a post on a recipe blog website can be seen as a document, even if there are sometimes some interactive elements (like being able to change ingredient amounts based on desired portion sizes), and even if there's usually a CMS behind the scenes helping the website author update their recipes, as the written recipe is at the core of what is being transmitted.

On websites the wide array of interactive elements do blur the lines between documents and apps, but the web was designed as a document sharing medium first and had app functionality bolted onto it afterwards. It's perfectly possible to have a website with zero JavaScript.

I don't know if that fully answers your question, but hopefully it's of some use.


it informs it. not sure it's a settled subject in my head per se though.

normally, when i think of a document, i think of something that is to be printed / printable properly. this puts javascript out of the picture for the most part, though not necessarily entirely. some pages sadly don't even load their content without javascript these days, like SPAs, or require custom streaming.

i needed to print directions from google maps one time for example, and even the inbuilt solution is basically just a fancy print screen of a page that was mostly rendered with javascript (or similar, i don't know their tech stack, not necessarily relevant). but then this brings about the idea that the page can be interactive, while exposing an end result that is printable.

or consider css. modern css has animations. one can even implement a navbar without any js, just pure css (and i very much appreciate when people do!). i'd permit media queries, but i'm not sure about fancy animated effects.

another thing i might want to bring up is grafana. it's just interactive charts. if i disable the autorefresh, it's not live either. requires javascript, but i believe if someone wanted to chart something some other way that is not grafana, it's possible to do some visualizations with just css alone as well in a way that is manipulable. end result is again static. i could conceivably print it.

i'm not even sure pure html, with no embedded js and css, escapes the non-document fate guaranteed. video tags include videos after all.

for me the bigger question is usually how much arbitrary execution a website requires instead. if it's all fixed function stuff, like html or css, i'd grade that higher than i'd websites requiring arbitrary code execution. but then technically modern fonts are also virtual machine bytecode that is executed during font rendering, so even just putting text on the screen can require arbitrary code execution. and even if we don't go that far, you do need to hold onto some state, since html is not a regular language for example (cue can't parse html with regex meme). and this isn't even getting into all the weird and whacky multimedia formats.


I think you're getting hung up on the technology and not looking at the substance of what is being delivered.

Let's use your example of a HTML page that contains a video tag. Let's say this is the only visible content on the page, just a video and nothing else. Is this a document? I would say not. Why? The primary content on the page is based on an interactive object, and that interaction goes beyond navigation to other pages.

To use an analogy, I'm guessing you understand what a TV station is and what a radio station is, but to summarise, radio is focused on transmission of audio, and TV transmits both video and audio. You use a TV to watch TV stations and a radio to listen to radio stations. Now consider, in some countries, radio stations are also broadcast as TV channels. When you listen to a radio station in this way, does your TV become a radio? Debatable, but what is not debatable is that the audio is the primary focus regardless of whether you're listening via a TV or a radio.

Similarly, the web platform is a bit like a TV, in that it supports different forms of content (apps, documents, and those that blur the lines between them). The key point is that experience is different when you're using the web to consume documents versus when you're using the web for apps. It doesn't matter whether you build a text-heavy webpage using no JS or lots of it, but what does matter is how you interact with the content. If you can imagine a getting a similar experience out of a book or magazine, then that's a document.

As hinted at before, there are sites that blur the differences between documents and apps, but even with acknowledging that it's possible to blend documents and apps, it's also possible to acknowledge that documents and apps can be distinct content consumption experiences.


A document is originally a scroll of papyrus. All other analogies flow from there. A video page on YouTube is kind of like a papyrus with a moving picture (that you can't actually do on papyrus but it flows through the analogy chain well enough). A game of Minecraft is nothing like a document, any more than the sky is a document. A static Minecraft world might be viewed as a 3D document.

Seems like one required criterion, maybe even the most important criterion, is that a document is static. It can be displayed in a way that changes with time (such as playing video) but it's a dynamic view over static data (you can scrub back and forth and the frames are always the same). A 3D model could also be considered a document, even if you can fly through it, even if it's got a looping or scrubbable animation.


Anything I can print and still get most of the utility is a document. Even expand it a little to Harry Potter style print+video.

IMHO the distinction is on interactivity, if I'm expected to click around to change state (not just get to other page) then its an app, if not, it's a document.


Static (informative) content, for a first pass heuristic.

You sir, you would be fairly dumbfounded to find that most people think that webpages are for showing trivial things founded on the backend side of them applications. Like when you want to change a filter on your amazon page and it suddenly give you a different page altogether, you know?

Most pages probably don't need to be anything else.

I hope we can move past the movement of everything should be a web app.


You missed the point. It's not about everything has to be an app. It's about thinking about webapps with the same mindset as ordinary (dektop) apps.

I didn't say Amazon was just a webpage, did I. Perhaps you're dumbfounded because all you use on the web are web apps.

Should browsers enforce per-tab memory budgets?

Maybe not by default but it'd be good to have the option, yeah.

If you use a 32-bit browser, each tab is limited to 2 GiB. Firefox still publishes 32 bit builds for Linux.

Edge and Opera GX provide adjustable memory limit.

Youtube is the most memory guzzling website of them all.

This has been going on in other professions for a long time. See the "children of the magenta line" talk about pilots losing the ability to hand-fly.

Another oft-cited article here is William Langewiesche's article on the AF447 crash (https://archive.vanityfair.com/article/2014/10/the-human-fac...):

> To put it briefly, automation has made it more and more unlikely that ordinary airline pilots will ever have to face a raw crisis in flight—but also more and more unlikely that they will be able to cope with such a crisis if one arises. Moreover, it is not clear that there is a way to resolve this paradox.


I bought Sully Sullenberger's book in early 2012. He's the pilot who perfectly ditched his Airbus A320 in the Hudson River after losing both engines on takeoff to bird strikes.

One of the things from the book was how Sully spent a lot of time investigating other pilots' accidents: 'was there anything that pilot could have done to have survived?' When he got to his own emergency situation over the Hudson, time slowed down and he decided over the course of a few seconds that ditching in the river was their only option.

"One way of looking at this might be that for 42 years, I've been making small, regular deposits in this bank of experience, education and training. And on January 15, the balance was sufficient so that I could make a very large withdrawal." https://en.wikipedia.org/wiki/Sully_Sullenberger


s/ditched/expertly landed on an improvised water runway/


This reminded me of a 2019 article in The Atlantic about this: https://www.theatlantic.com/magazine/archive/2019/05/the-tro...


I know this type of approach was rejected at the beginning, but you can also just ask CoreGraphics to use the GPU for 2D rendering (and I'm sure there are equivalent paths in e.g. Skia or Cairo).

On macOS/iOS, the easiest way would probably be to set the drawsAsynchronously property on a CALayer. Then, all CoreGraphics operations on the context passed back to the layer via drawInContext: will be GPU accelerated.

Lastly, there are some pretty sharp edges to this API, so definitely don't go flipping it on for every layer/view in your view hierarchy.


There's a lot to discuss here, a very interesting comment. I wouldn't want to talk too much publicly about certain technical elements, and because I don't want to encourage solutions decided by LLMs, however the Skia/Cairo-GL angle is interesting but would be a heavy dependency and does not help Linux, where the same gfxterm.c policy drives the OpenGL backend. The vtable abstraction was specifically designed so the rendering logic is written once and the platform just supplies the draw primitives.


This seems like the "obvious" solution. Why was the rejected?

EDIT: It appears to be an objection to GPU programming entirely.


I'm not sure if this works well for more demanding games, but recently I wanted to let my kid play Number Munchers and Oregon Trail and just built a webpage for those games using js-dos. It worked well enough for those games.


I've seen JS-DOS used for id software stuff like DOOM so I think it's plenty capable.

The person who created js-dos runs https://dos.zone as well which has a bunch of abandonware running on the browser.


DE is definitely not meant for older computers, it contains gigabytes of 2D sprites


There's already a popular OS that disables overcommit by default (Windows). The problem with this is that disallowing overcommit (especially with software that doesn't expect that) can mean you don't get anywhere close to actually using all the RAM that's installed on your system.


Windows also splits memory allocations between allocating the virtual space and committing real memory. So you can allocate a large VM when you need one and use piecemeal commits within that space.

POSIX not so much.


I am regularly getting close to 100% RAM usage on Windows doing data processing in Python/numpy


It is surfaced to apps, but the "just detecting that connectivity sucks" heuristic turns out to be not all that easy to implement. There doesn't seem to be a better heuristic than "try and let the app decide if waited too long".

There are some comments here: https://developer.apple.com/documentation/systemconfiguratio...


Copying the file likely forces the creation of a new one with no or lower filesystem fragmentation (e.g. a 1MB file probably gets assigned to 1MB of consecutive FS blocks). Then those FS blocks likely get assigned to flash dies in a way that makes sense (i.e. the FS blocks are evenly distributed across flash dies). This can improve I/O perf by some constant factor. See https://www.usenix.org/system/files/fast24-jun.pdf for instance for more explanation.

I would say that the much more common degradation is caused by write amplification due to a nearly full flash drive (or a flash drive that appears nearly full to the FTL because the system doesn't implement some TRIM-like mechanism to tell the FTL about free blocks). This generally leads to systemwide slowdown though rather than slowdown accessing just one particular file.

This was especially prevalent on some older Android devices which didn't bother to implement TRIM or an equivalent feature (which even affected the Google devices, like the Nexus 7).


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: