Which was acquired by a suspicious company and started releasing new versions not based on the public GitHub repo, so with who knows what. Most people migrated off it for that reason.
OS are general-purpose system, it's always been the case that applications being known workload they had better knowledge of what they need (it just doesn't matter to most of them). That's why you can tune your db configuration, or you can police individual processes using various tunables, or you can ship your program with a better allocator than f'ng glibc malloc.
And a modern browser is a pretty complicated process manager, the OS has no understanding of what the various processes do or what state they're in.
Is this really going to do a lot? My tab suspension needs are covered pretty well by browser/PC reboots. I don't reboot if there's something I'm actively using and tabs I'm not using never get loaded after I bring the browser back up.
My most recently purhased laptop may not have ever been rebooted. I don't remember whether it ended up getting rebooted once while I was setting things up. I'm sure I'll end up rebooting it eventually, but it's not exactly an everyday thing.
> Any inactive tabs will be reloaded when you need them.
Anyone have ideas why the tab's memory contents can't be offloaded to SSD and restored instead? Personally I don't like losing state (e.g. filled in forms, scroll position, deleted posts, etc) from using other extensions like Great Suspender.
Just a guess but probably something to do with running states in the background but connected to external thingies, hard to offload and restore as-is if the external thingies (or the local one) detect timeouts. Easier to just reload the URL than bother to restore an unusable webpage's state I suppose.
Don't forget that reloading through the networks gives Google the ability to keep tracking. The requests will go only to that URL, but Google will get it one way or another...
Why would Google need a reload to keep tracking (they already control the browser)? That this feature/implementation was driven by desire for more tracking sounds far fetched to me.
2. it's very messy data, it's a bunch of seas of nodes (the DOM, the JS heap, the styling info, etc...)
3. I wouldn't be surprised if it was data which isn't fully isolated (e.g. shared style caches), meaning it first has to be fully forked to resolve into a self-contained bundle
OS have the ability to just freeze and store / restore memory, but I'm not sure they give that capability to use processes.
Sure, so were save files for many older games, but it was a dump of the document / game state, which was a fraction of the running program, and probably designed for that in mind in the first place.
Image-based systems (smalltalk, self) would probably be a better model for a live tab, but it still requires things to line up.
As a web app developer? I’ve seen all sorts of ridiculous behaviour that I can’t explain for reasons other than weird wake-from-sleep implementations. I assume that any tab suspension implementations will follow the same patterns.
I think it is possible. Typical web process memory size is about 30-500 Mb. Writing 500 Mb sequentially on a spinning HDD takes 5 to 10 seconds, and probably you can discard a lot before saving (like JIT code, JS bytecode, CSS dependency trees, HTTP caches, localstorage etc.), and 500 Mb pages are rare.
For comparison, if you don't unload the page completely, and system gets into swapping then there will be random access pattern with speed about 400 Kb/s on a HDD. So it is faster to unload 500 Mb sequentially than swap out/in 5 Mb.
This is why getting away from optimizing all our software around the disk being the major bottleneck will be a great thing for computing. So many optimizations become possible when your storage isn't in the hot path.
He said owned by an advertising company. Read it again. None of the companies you listed are owned by an advertising company. Your post is written as if you work for Google and you need to defend them.
I feel like this line of thinking is unnecessarily binary.
Think of it this way: what percentage of the revenue of each of these businesses comes from advertising? Where can you put your (understandably) limited trust given the limited list of options?
There's a huge difference between the incentives of Alphabet and, _say_, Mozilla from the revenue source pov.
I am not sure I understand. Mozilla is more dependent on those 400M than apple on 10-15B so (hypothetically) they are more willing to please Google or at least not to disturb them much, than Apple. So, purely from revenue pov Firefox is nearly as much concerned about google's bussiness as google is.
It also saves something much more important than your device's battery - your attention and mental energy! uBlock Origin has, to date, blocked 1.6 million requests for me for this installation of firefox. Imagine all the power and mental energy I saved from this. Every time I have to use someone else's computer I get tired of the ads they show within minutes (Windows even has ads on the start menu nowadays!)
If you haven't done this in some time and use a Mac, give Safari a shot.
From the performance and energy usage perspective, it's wonderful. I switched more than 3 years ago and never looked back. The only thing that feels sluggish are the Google web apps (FUD in my opinion).
I've been doing front-end dev for almost 20 years and now use Chromium very rarely and only in work related context.
I'm at the risk of sounding naive here, but using any browser that is not Chrome makes the world a slightly better place (just a tiny bit), same goes with helping your non-techie friends do the same.
(yes, I know Safari is not perfect, but Chrome is cancer/storefront and it is one often things that make use collectively a tiny bit more stupid)
I'd be happy using Safari, but the deal-breaker for me is the lack of uBlock Origin. There are other suggestions that people mention - Ghostery and Wipr for example - but somehow they don't give me confidence that they're going to be as reliable.
Couldn’t agree more. I tried to switch to safari awhile back, and loved most of the interface, the snappiness, the open tab view for people like that open a gazillion tabs. But the ads I struggled to get rid of (specifically YouTube commercials) pushed me back to chrome with ublock.
I used to have a "hardcore" setup with ublock origin and pihole (plus a bunch of other tools, a non creepy VPN). Plus, I’m probably more focused on privacy even than the _average_ HN reader, due to the nature of my work, but to be fair, nowadays I’m pretty happy with Adguard (w.custom exclusion lists), Hush and private relay. I don’t see any ads. I do pay for YT however.
It’s not perfect but the balance of effort versus results is pretty good imho. The only thing I really miss is being able to disable JS per site, instead of globally, which Safari doesn’t allow :/
Check out Orion! It's a Webkit-based browser like Safari but the devs also ported the extension APIs from Chrome and Firefox, so you can install Chrome and Firefox extensions. It's Mac-only and in beta but, there's tons of features that could be worth checking it out.
> “Chrome 12 [an old version] was the best Chrome", but since I’ve come to see underneath that for me what I wanted was a fast tight browser, and once I had that, pretty much by definition most subsequent work was just gonna make it worse.
Have you tried using Tab Groups? I'm using Work/Study/Personal and switch between them at the end of each pomodoro (hit CMD + Shift + <up, down>).
It's not as good as FF containers or separate profiles in terms of sandboxing/isolation, but in terms of UX it's pretty neat.
I keep HN and all of my distractions in one tab group then just hit one key to hide them and only see the work context, all distractions are gone.
This approach works well enough for me because it feels super simple, although I miss FF containers a little bit.
Safari has a terrible UI and it lacks vertical tabs (I still don't understand how anyone uses horizontal tabs as they are clearly inferior if you have more than a few tabs open) and uBlock. I use it for a handful of financial websites where fingerprint ID is more convenient.
If you ever want to debug/mess with the memory saver you can look at "chrome://discards".
Chromium already discarded tabs when the system memory pressure was high, what the memory saver brings is a smarter policy [0]. For example, tabs that are inactive for more than two hours will be automatically discarded now.
They are moving in the right direction. Browser vendors should optimize for low memory usage and not for speed in bechmarks at the cost of memory usage, because when the system runs out of memory everything becomes so slow that benchmark performance doesn't matter anymore. The only people who win from benchmark optimization are those with 16-32 Gb of RAM (for example, Google employees).
So I would rather choose a browser with 2x-3x lower benchmark performance if it could consume 2x-3x less memory. Firefox is basically unusable on a 2Gb system as long as you useit more than 15 minutes.
One of the solutions could be to freeze and compress background tabs. There is no need to keep in memory HTTP caches, localstorage, heavy JIT caches, CSS selector dependency trees, JS bytecode, DOM nodes without JS expandos attached. Freezing background tabs also allows to save energy.
> The only people who win from benchmark optimization are those with 16-32 Gb of RAM (for example, Google employees).
Limiting RAM has become a silly market segmentation tactic, and I’d say there is absolutely no reason to buy a PC with less than 16 GB of RAM these days. It’s downright stupid you can still buy machines with 6 GB. Better to buy several generations down or used—old CPUs are still perfectly serviceable unless you’re planning to submit to some serious C++/Rust compiler punishment. (Says the person with an 8GB dual-core Haswell that is showing definite signs of obsolescence, but I still stand by my words.)
4Gb is more than enough with Firefox on Linux with more than 30 tabs assuming you use uBlock Origin and uMatrix :)
Source: did just that on a daily basis on my recently replaced 10 year old laptop. I probably would have even been able to handle 2Gb assuming Firefox was the only application running.
People use what they have, I won’t blame them for it. (Although the notion that web apps—such as Facebook, GMail, Google Docs, or PDF.js—are less resource-intensive than “normal” desktop usage does not seem to hold much water to me, and those are usually included when a machine is said to be used “just for web browsing”. So if the experience ends up quite miserable I won’t be surprised.) But I’ve shopped for a laptop for a relative some months ago and am a bit testy about how manufacturers seem to be saving money on frickin’ RAM (or more realistically segmenting the market using it). Just... don’t fall for it if you have a choice.
if the RAM is upgradable then I'd say yes.. 8GB RAM stick costs ~25€ and anyone with a screwdriver can make the swap...
if it's not upgradable then it's up to the user to determine if it's worth it to replace the whole laptop, but if it has 4GB of RAM its other specs are probably gonna be outdated as well and you can buy very good refurbished laptops for under 300€ these days...
Exactly. The examples are Mac laptops with soldered memory, which several years later will still have a great screen, case, fast CPU, but will be unusable due to having too little RAM. In the best case the user will have to buy a new motherboard and throw away perfectly working CPU and GPU, and in the worst case buy a new device.
Also, even 15-year old CPUs are still pretty fast and can do billions arithmetic operations per second. Only because Intel decided not to add several more address lines which cost them basically nothing, these machines have to be thrown away.
Of course. I mean that as far as I can see one should normally save on just about everything else, including going back multiple CPU generations (let alone giving up on a discrete GPU) and buying a used laptop instead of a new one (in case it’s a laptop), before opting for less RAM. (I’m not including Chromebooks in this calculation, as those have never been available to me.)
I use (an old version from GitHub, it was bought by a spyware company) of The Great Suspender to save RAM. Though I think both FF and Chrome added such features natively, though they are less aggressive and (afaik) cannot be configured. Edit: someone mentioned chrome://discards
> The only people who win from benchmark optimization are those with 16-32 Gb of RAM (for example, Google employees).
> Firefox is basically unusable on a 2Gb system <...>
I just had a look at one of the largest laptop retailers in the UK, and they don't sell laptops with less than 4GB anymore. Checking the steam survey [0] (which is biased towards gamers but still a very representative sample of PC owners and users), almost 95% of people have more than 4GB. Realistically, 2GB and even 4GB devices are at the absolute bottom end of devices that are in use in desktop computing.
Mobile is a different beast, but android has a specific lightweight OS for 2GB devices, and 4GB devices are budget at this stage. 6GB is the requirement for full-fat android. [1]
You may or may not agree that it's necessary, but the reality is that 2GB device are bordering on obsolete in 2022.
> One of the solutions could be to freeze and compress background tabs.
The laptop I had supported 4 Gb (due to artificial limitations by Intel), but it started to switch off randomly and I found out that if you remove one (any) of RAM cards, then it can work without any issues. So this is how you can have a 2Gb device in 2022.
Having two laptops is twice better than having just one, so I decided to continue using it. Maybe I will connect it as a virtual monitor for a second laptop (then 2 Gb should be enough), but I am not sure if Wayland supports this.
Also, even if new laptos have 4+ Gb of RAM, there are still 5-10 years old models in use.
>So this is how you can have a 2Gb device in 2022.
Can you please point out which laptop in 2022 is being sold with 2GB of ram limitation? Really curious.
The smallest I could find for sale in my country is 4GB and I had to look really hard as they're not cheaper than buying something with 8GB of ram or they're just ARM Chromebooks.
Even most budget chinese Android phones rarely ship with less than 4GB of RAM anymore. So you made me very curious about 2GB laptops retailing in 2022.
Edit: wow, why the downvotes guys? Is it against the rules to aske questions?
In which country can you buy that product retail locally? (not via AliExpress as that moves the goalposts considering all the weird stuff you can find there)
In Russia. The store website [1] says that they can deliver it within 2 hours, so it can be bought locally. Irbis seems to be a brand of cheap laptops targeted at Russia, so it might be not known in other countries or they are sold there under another brand.
By the way, one of the buyers wrote that it is "great for studying" and another wrote that "it is confortable to use with Linux".
Anything with Celeron instead of the processor and a year-two old.
There are tons of refurbs, new-old stock and blatant lies on Amazon so you can really expect someone who doesn't know shit (eg only knows and bother about persistent memory, completely oblivious about RAM) can buy a device with 2Gb RAM in 2022.
Not since the move to M1 SoCs where the RAM is soldered close to the CPU to minimize latency. Replaceable DIMMS are a technical no-go for such scenario.
Of course they could just deaig and sell new motherboards with new chips for the older laptops chassis, like framework does, but knowing Apple, such user upgrades will not happen.
But aren't the CPU, GPU and RAM the most expensive components on a MB, by far? I wouldn't expect such a board to be significantly less expensive than a complete one.
I don't think so. I tried to look up the price of CPU in my laptop, but it is not sold separately (it is soldered on the motherboard). The desktop version of the same CPU, which has 50% higher score in Passmark benchmark, costs 25% of the price of laptop. RAM costs approximately 10% of the price. So RAM + CPU make only 35% of total price.
Sure, but a desktop computer with 50% higher scores than a laptop with "laptop version of cpu" will cost less than the laptop (even counting a monitor), so I'm not sure that comparison holds.
For example, an HP Elitedesk 800 mini (very small, so using SO-DIMMs and integrated everything - basically a non-portable laptop) will run you around 800 Euros, while the "equivalent" Elitebook 830/840 will run you 1500 euros. Specs are "similar", same generation mid-level i5, same RAM, same SSD. Main difference is the Elitedesk will have desktop-class CPU. Throw in a cheap HP screen (200 euro - Elitebook laptops have ridiculously bad screens, so that's fair), and you get to 2/3 the price of the laptop.
In modern DDR5 settings the RAM speeds of DIMM slots are actually significantly slower than the RAM speeds of soldered chips. Modern chips are hugely dependent on RAM speeds for optimum performance and with the way the M1/M2 platform evolved from smartphones and tablets where everything is close to the CPU/GPU and soldered down I'd expect their chips to be optimised for this layout.
Apple is blatantly anti upgrade (just see the SSD situation on their desktop offerings) but that's not the only reason they solder stuff down.
I believe Dell is working on a new, open design for PCBs where this performance problem is smaller or even nonexistent. You lose the ability to do partial upgrades with the new system but gain the performance impact that is driving some companies to soldering down RAM for performance reasons.
For devices with slower RAM there is no excuse. Just an upsell to make you pay $100 for 8GiB of RAM.
I would prefer to have 32 Gb of cheap "slow" 3200 MT/s RAM rather than 4 or 8 Gb of soldered 4300 MT/s LPDDR4 RAM. The increase in speed isn't worth decrease in size.
Also, in cheap laptops soldered RAM often has lower speeds, same as replaceable one.
And if RAM has to be soldered, then the board with CPU, GPU and RAM could be made replaceable so that you can upgrade it later without buying a new device. Obviously, manufacturers don't want that.
> And if RAM has to be soldered, then the board with CPU, GPU and RAM could be made replaceable so that you can upgrade it later without buying a new device. Obviously, manufacturers don't want that.
I also prefer upgradeable laptops over bleeding edge performance but the reality is that most consumers never upgrade their laptops (and if they do, only to add more storage). Until a large amount of customers start factoring repairability and upgradeability into their purchasing decisions, we'll only see soldered down RAM.
I don't know about the specifics of DDR5, and specifically LPDDR5, as used by Apple, but many other manufacturers solder their chips, although their specs say that the speed is the same as in models with separate DIMMs.
One such example is the HP Elitebook 1040 G9. The tablet-like version has soldered RAM, whereas the regular has external modules. They both use 4800 MHz DDR5.
Regarding Apple Silicon, they claim that their soldered LPDDR5-6400 RAM can provide 100Gb/s of bandwith (per one chip?), which is amazing, but it seems that the CPU cannot fully utilize this bandwith.
For comparison, a cheap removable DDR4 module at 3200MT/s can provide theoretical bandwith around 25 Gb/s and two of them can provide 50 Gb/s which is also very fast (for me) and good enough for many tasks. More expensive DDR5 modules can provide up to 50 Gb/s bandwidth per module, and four of them give you 200 Gb/s of theoretical throughput.
So I don't see problems with using removable DDR5 modules. They are good enough, and being able to expand RAM cheaply is more important, than getting 2x bandwidth, that you cannot utilize, at a premium price.
Those have been good enough for a while now. My late 2013 MBP worked fine until last year, when I stopped using it for unrelated reasons. It had an iris something, and IIRC that CPU wasn't even brand new when that mac model came out.
Sure, I didn't play games on it. But for regular "office use" I never had any performance issue.
For my current laptop, I specifically wanted a model without a dedicated GPU. Didn't want the hassle of dealing with that (I run Linux) and also there was no reason for me to pay extra for something I don't need. It was cheaper for me to buy a dedicated GPU for my desktop.
You check laptop offerings in one of the most wealthy countries on earth - and given that you still found devices with 4GB of ram is concerning for me. I feel like better support for 2gb devices could be life-changing for many people around the world.
Out of curiosity I decided to look at cheap laptops in my country. One of them is $240 Irbis NB77 laptop with IPS display, 2Gb of RAM (soldered as I understood), 4-core Atom Z3735F CPU, only 2 USB ports, 32 Gb of eMMC and, the worst of all, Windows 10, which probably will take all of the space on a drive.
But of course there are cheaper laptops with 4Gb RAM, so this one seems more like an exception. There are even tablets that cost less and have 12 Gb of RAM, although they are sold by suspicious sellers from China.
That's Bay Trail Atom. Launch date: Q1'14, two years after the platform launch, two years before the platform sees the latest release.
Or this is old new stock (of Bay Trail Atoms?) of something completely insane. Come on, 8 years! I had Acer W4-821 tablet with similar CPU in 2014! And was quite hampered by an upgrade to Win10, though I managed to run Virtual Box with CentOS on it to live test some code.
for 245€ I can get a refurbished Lenovo T470 with FullHD display, i5 7300U, 256GB SSD, and 8GB DDR4 RAM (and a Windows 10 Pro licence)...
There's absolutely no point in buying new cheap laptops these days.., Big businesses are always getting rid of 5 year old laptops because their 5-year warranty expired, and the prices get low because they're old, but those 5 year old laptops are comparable to 1 year old laptops these days, cause in 2017-2021 there has been 0 improvements in the laptop world...
I wanted to replace my top of the line 2017 Dell XPS 9560 in 2021 after 4 years of use and literally didn't find any laptop that was noticeably better to justify paying for it....
> because when the system runs out of memory everything becomes so slow that benchmark performance doesn't matter anymore
Huh? When the system is getting close to running out of memory, isn't the least-recently-used memory swapped out to disk by the OS? And if you're using an SSD like nearly everyone these days, it isn't even noticeable.
Freezing tabs is a good idea to ensure the memory stops being accessed precisely so it can be swapped... but besides this, why not let the browser use all the memory it needs, and just let swap do its job? It seems entirely redundant for a browser to try to save memory by essentially implementing its own secondary swap strategy.
> When the system is getting close to running out of memory, isn't the least-recently-used memory swapped out to disk by the OS?
After all least-recently used memory is swapped out, the time comes to swap out recently used memory and it becomes noticeable, especially with a spinning disk with 400Kb/sec random write speed.
Swapping is extremely ineffective. Unloading a tab allows to use sequential write which is orders faster than random write even with SSD.
If you're in a position where you're swapping out recently used memory then you have specific computing needs (like running VM's) where you should have purchased more memory.
For keeping things open in the background that aren't being actively used, swapping is extremely effective.
I don't see any good reason why background applications should get swapped out by the OS, but background tabs should be handled by a different mechanism.
(And I have no idea what sequential write has to do with anything...? If you're talking about coming back to an old tab, loading it from swap will nearly always be faster than reloading over the internet, no?)
For HDD and SDD, it is much faster to write a large chunk of data at once than write many small chunks. For example, writing 500 Mb at once is faster than writing 50Mb worth of 4Kb chunks.
For HDD, sequential write speed can be 50 Mb/s and random write speed for 4Kb chunks can be as low as 400 Kb/s. For SSD, there is also a difference in speed on order of 50x.
Swapping uses 4Kb chunks and therefore uses the drive in the most inefficient mode. Alternative mechanism can employ faster and effective sequential access.
I'm not sure that's how it works. For your HDD to reach that speed in sequential write, the free space should be contiguous. Also, a modern HDD will write faster than that in that best case scenario.
If swap needs to write 10 MB, in whatever chunk size, it will send them one after the other, just like the file system. Regular file systems don't have 100 MB sector sizes, either.
> For SSD, there is also a difference in speed on order of 50x.
I highly doubt that. Source: running fio on my SSD. SSDs actually can take advantage of parallelization, writing to multiple places at the same time, which a spinning drive obviously can't do.
This article [1] contains benchmark results for several SSDs and a good HDD. You can compare sequential read speed in fastest mode (SEQ1M) and random read speed in slowest mode (RND4K) and see that there is a huge difference for both HDD and SSD on order of 50x (for SSD) and 300x (for HDD).
HDD is very slow for random read/write access because it needs to wait until the desired sector will spin underneath the head, one spin takes approximately 10 ms, and on average you need to wait half of that time.
> For your HDD to reach that speed in sequential write, the free space should be contiguous.
If the file system is smart enough to allocate large chunks of free sectors then the write will be sequential. If there are no large contiguos chunks then maybe you need to defragment your drive using standard Windows tools (don't know if there are similar tools for Linux) otherwise write speed will be very low.
> SSDs actually can take advantage of parallelization
This doesn't matter when you need to swap pages in because you retrieve one page after other and cannot parallelize this (as pages are swapped in only when they are accessed by the program).
But I can agree that buying $30 SSD is probably the cheapest way to speed up an old computer.
Your example is a worst-case scenario, where only one very small write operation happens at a time for a very small size, yet there are a lot of things to write.
It would seem that Linux swap uses the block device layer to handle actual I/O for swap. So, I think that if it only needs to write or read one single page at a time, then sure, it will be slow. But if you need to swap out a sizeable quantity of memory (meaning multiple pages), it will need to write or read multiple pages "at a time". Linux also tends to group pages together. Since reading and writing is async [0], as soon as the io operation has been sent, the next page will start to be handled, even if the actual io to disk hasn't finished. So, in practice, it's very likely that there are several IO operations happening at the same time from the drive's point of view.
The system is also highly likely to be doing some unrelated I/O, which is why parallelism helps a lot.
This is where the SSD will shine, because it will absolutely be able to handle multiple small IOs in parallel [1]. And also where, presumably, queue-ordering in the case of spinning drives can help here, too, by optimizing the order in which the paging operations will occur.
I'm not familiar with Windows, but I'd expect things to work somewhat similarly, especially since the swap is backed by an actual file system (but I don't know if the swap files have any properties that make it "special" - though I wouldn't be surprised for that to be the case).
But none of that matters as long as the system is pre-emptively swapping out old stuff, as it does. And if it decides to swap out 50 MB all at once, it doesn't matter if it's organized in separate 4 KB pages in memory, because it still writes them all out to disk sequentially in one go. Plus, it's doing it in the background anyways so who cares?
The only performance issues that are actually relevant here are if you get into thrashing because you've run out of memory totally (no longer pre-emptive), but that doesn't happen in normal usage. Or when you're swapping memory back in for an app/page that's scattered among many 4 KB pages on disk... but the point is that should still be faster than reloading the page over the internet! (And on SSD's it's blazingly fast since fragmentation on disk barely even matters.)
> Or when you're swapping memory back in for an app/page that's scattered among many 4 KB pages on disk... but the point is that should still be faster than reloading the page over the internet!
I don't think so. HDD can do approximately 100 IOPS, and with 4kB pages that gives you speed of 400Kb/s.
I had different cases when system worked poorly when there was not enough RAM. All of these happened to me on 4Gb Linux system:
- when a heavy page is opened in Firefox and it tries to allocate more than 500 Mb of RAM (for example, Google Street View that leaks RAM), the system swaps out Gnome desktop compsitor, and everything freezes for several minutes, you cannot even move a mouse or switch to a text console. Often the only solution is reboot. Why cannot Linux protect Wayland compositor from being swapped out I don't understand.
- when the system turns off the screen, it can swap out desktop compositor because it is not used, and there is a freeze for 20-30 seconds when you try to wake up the system. Why cannot it swap out something less important I don't understand.
So in practice swapping can produce long freezes when the system becomes completely unresponsive. I cannot agree with your statement that getting a page from swap is faster than loading from Internet.
If instead of swapping separate pages the system swapped out and in whole processes, the situation might be better.
By the way, out of curiosity I tried to investigate who uses so much memory that 4Gb becomes not enough by summing PSS (proportional set size) of processes, and I never got 4Gb used, it always was about 2.6-2.8 Gb used after which the system becomes prone to sudden freezes. "free" command also never showed number of "used" RAM above 3Gb. I guess Linux has not only issues with swapping, but also with counting used memory as well.
The long freezes you describe come from thrashing, when memory is at its limit. Forget about background apps/tabs, you simply don't have enough memory period. Swapping doesn't perform miracles.
And I was clear I wasn't talking about severely underprovisioned machines, such as you are describing. In normal usage where background apps/tabs are swapped out preemptively, there is no performance hit at all. And then when they're reloaded from swap -- yes, it's extremely fast. It's like loading a web page from your local drive, only even faster because it doesn't have to be interpreted.
If you're dealing with freezes of 20 seconds to several minutes, your machine is severely underpowered or somehow seriously misconfigured. You need to upgrade, not complain about how swap doesn't work.
"Memory saver" and "battery saver"? How about just disable JavaScript by default. Make it opt-in per tab with a banner alert for the user: "this site may drain your battery".
Nothing stops you from disabling javascript by default already; I do it for security reasons. A nice side effect is that many cookiewalls disappear too.
Glad to see that Chrome is putting effort into these areas. Battery is definitely the important one to me and it's disappointing that "throttling slow code after we've burned 80% of your battery" is the only thing that they're releasing here, but hopefully we'll see some future posts that actually improve the situation.
I really don't think this captures the scope of the problem. Here's an example:
1: Load NBC.com (or any other regular media site) in a "naked" web browser (just a plain browser, no ad blocking, noscript etc)
2: Open dev tools -> networking tab
3: Study the activity, look at requests made, size of requests, data the requests contain (remember, YOU are paying for these requests in terms of impact to battery, bandwidth, electricity usage etc)
I can see MB's of data transferred from my device, every time I scroll more network activity is performed (100's of requests per MINUTE), this is all made possible by "JS" which is the single biggest resource hog of any modern browser.
Turning JS off (whilst obviously crippling some pages) results in HUGE savings of bandwidth, reducing battery impact AND increasing privacy :). (You can also use noscript to allow/deny certain scripts from loading, and you'll be surprised how many pages work with JUST the root domain enabled, thus every third party script is not vital to the functioning of the page)
I seriously think modern browsers (including Firefox) need to implement features to reduce the amount of network requests a page can make, including to third party websites, and limit the amount of data a single page can consume. I'd call it a "browser firewall" similar to tracking mode, preventing third party requests entirely
Data does cost, contrary to what others make think, especially on mobile lines when out and about.
What does this do about page state like half-filled in forms?
Since I upgraded a couple days ago, I'm seeing that indeed every tab completely reloads when I switch to it if I haven't used it in a few hours.
But now I'm kinda worried that I'll leave something half-written and it'll be gone. Unfortunately there doesn't seem to be any way to test that in advance without waiting a few hours.
I also often rely on a long article being scrolled halfway through to save my place, or a long video I'm in the middle of, and I'm worried that my spot will be lost as well.
I find it extremely odd that they're not even mentioning anything about that -- e.g. whether you will lose data/place and you should disable this feature if that's unacceptable, or whether it does some fancy stuff to restore the state of anything that's a form, contenteditable, scroll position, or playback location.
The reason I open a tab is to load the page state. When I click to the tab, the last thing I want is a reload.
There should be a middle ground that can pause all resource use, and then resume it, without reloading state. Google, Amazon, Twitter, Youtube subframe/embeds are resource hogs.
I've used Total Suspender on Firefox for a few years now. It has whitelist/blacklist, ignore pinned and sound playing tabs. Works great for the most part. It is a bit annoying that youtube vids lose the timestamp, but youtube is a massive hog so it is a worthwhile tradeoff.
120 comments
[ 0.18 ms ] story [ 178 ms ] threadFeels weird to have the performance control inside an application, instead of it following what has been set by the OS.
OS are general-purpose system, it's always been the case that applications being known workload they had better knowledge of what they need (it just doesn't matter to most of them). That's why you can tune your db configuration, or you can police individual processes using various tunables, or you can ship your program with a better allocator than f'ng glibc malloc.
And a modern browser is a pretty complicated process manager, the OS has no understanding of what the various processes do or what state they're in.
Anyone have ideas why the tab's memory contents can't be offloaded to SSD and restored instead? Personally I don't like losing state (e.g. filled in forms, scroll position, deleted posts, etc) from using other extensions like Great Suspender.
2. it's very messy data, it's a bunch of seas of nodes (the DOM, the JS heap, the styling info, etc...)
3. I wouldn't be surprised if it was data which isn't fully isolated (e.g. shared style caches), meaning it first has to be fully forked to resolve into a self-contained bundle
OS have the ability to just freeze and store / restore memory, but I'm not sure they give that capability to use processes.
Image-based systems (smalltalk, self) would probably be a better model for a live tab, but it still requires things to line up.
For comparison, if you don't unload the page completely, and system gets into swapping then there will be random access pattern with speed about 400 Kb/s on a HDD. So it is faster to unload 500 Mb sequentially than swap out/in 5 Mb.
From the perspective of Google, your browser or your phone are just ad spaces.
Apple sells ads, so that rules out Safari.
Microsoft sells ads, so no Edge or Internet Explorer.
Mozilla sells ads, so no Firefox.
Brave sells ads, so no Brave.
What’s left? Lynx?
Think of it this way: what percentage of the revenue of each of these businesses comes from advertising? Where can you put your (understandably) limited trust given the limited list of options?
There's a huge difference between the incentives of Alphabet and, _say_, Mozilla from the revenue source pov.
^1 ca $400M paid to Mozilla for search partnerships by Google, per annum
^2 probably ca 10-15B paid to Apple, pa
How would you answer your own question?
> Microsoft sells ads
> Mozilla sells ads
what?
I've been doing front-end dev for almost 20 years and now use Chromium very rarely and only in work related context.
I'm at the risk of sounding naive here, but using any browser that is not Chrome makes the world a slightly better place (just a tiny bit), same goes with helping your non-techie friends do the same.
(yes, I know Safari is not perfect, but Chrome is cancer/storefront and it is one often things that make use collectively a tiny bit more stupid)
It’s not perfect but the balance of effort versus results is pretty good imho. The only thing I really miss is being able to disable JS per site, instead of globally, which Safari doesn’t allow :/
> “Chrome 12 [an old version] was the best Chrome", but since I’ve come to see underneath that for me what I wanted was a fast tight browser, and once I had that, pretty much by definition most subsequent work was just gonna make it worse.
Safari is today’s fast tight browser I dare say.
I gave Safari a try and I loved it, but the lack of Profiles made me switch back to Chrome. I hope they implement such feature in the future.
It's not as good as FF containers or separate profiles in terms of sandboxing/isolation, but in terms of UX it's pretty neat. I keep HN and all of my distractions in one tab group then just hit one key to hide them and only see the work context, all distractions are gone.
This approach works well enough for me because it feels super simple, although I miss FF containers a little bit.
Chromium already discarded tabs when the system memory pressure was high, what the memory saver brings is a smarter policy [0]. For example, tabs that are inactive for more than two hours will be automatically discarded now.
[0] https://source.chromium.org/chromium/chromium/src/+/main:chr...
So I would rather choose a browser with 2x-3x lower benchmark performance if it could consume 2x-3x less memory. Firefox is basically unusable on a 2Gb system as long as you useit more than 15 minutes.
One of the solutions could be to freeze and compress background tabs. There is no need to keep in memory HTTP caches, localstorage, heavy JIT caches, CSS selector dependency trees, JS bytecode, DOM nodes without JS expandos attached. Freezing background tabs also allows to save energy.
Limiting RAM has become a silly market segmentation tactic, and I’d say there is absolutely no reason to buy a PC with less than 16 GB of RAM these days. It’s downright stupid you can still buy machines with 6 GB. Better to buy several generations down or used—old CPUs are still perfectly serviceable unless you’re planning to submit to some serious C++/Rust compiler punishment. (Says the person with an 8GB dual-core Haswell that is showing definite signs of obsolescence, but I still stand by my words.)
Source: did just that on a daily basis on my recently replaced 10 year old laptop. I probably would have even been able to handle 2Gb assuming Firefox was the only application running.
if it's not upgradable then it's up to the user to determine if it's worth it to replace the whole laptop, but if it has 4GB of RAM its other specs are probably gonna be outdated as well and you can buy very good refurbished laptops for under 300€ these days...
Also, even 15-year old CPUs are still pretty fast and can do billions arithmetic operations per second. Only because Intel decided not to add several more address lines which cost them basically nothing, these machines have to be thrown away.
You know, people don't have unlimited money.
Of course. I mean that as far as I can see one should normally save on just about everything else, including going back multiple CPU generations (let alone giving up on a discrete GPU) and buying a used laptop instead of a new one (in case it’s a laptop), before opting for less RAM. (I’m not including Chromebooks in this calculation, as those have never been available to me.)
> Firefox is basically unusable on a 2Gb system <...>
I just had a look at one of the largest laptop retailers in the UK, and they don't sell laptops with less than 4GB anymore. Checking the steam survey [0] (which is biased towards gamers but still a very representative sample of PC owners and users), almost 95% of people have more than 4GB. Realistically, 2GB and even 4GB devices are at the absolute bottom end of devices that are in use in desktop computing.
Mobile is a different beast, but android has a specific lightweight OS for 2GB devices, and 4GB devices are budget at this stage. 6GB is the requirement for full-fat android. [1]
You may or may not agree that it's necessary, but the reality is that 2GB device are bordering on obsolete in 2022.
> One of the solutions could be to freeze and compress background tabs.
Firefox supports this already [2]
[0] https://store.steampowered.com/hwsurvey/Steam-Hardware-Softw...
[1] https://www.xda-developers.com/android-12-performance-class/
[2] https://support.mozilla.org/en-US/kb/unload-inactive-tabs-sa...
Having two laptops is twice better than having just one, so I decided to continue using it. Maybe I will connect it as a virtual monitor for a second laptop (then 2 Gb should be enough), but I am not sure if Wayland supports this.
Also, even if new laptos have 4+ Gb of RAM, there are still 5-10 years old models in use.
Can you please point out which laptop in 2022 is being sold with 2GB of ram limitation? Really curious.
The smallest I could find for sale in my country is 4GB and I had to look really hard as they're not cheaper than buying something with 8GB of ram or they're just ARM Chromebooks.
Even most budget chinese Android phones rarely ship with less than 4GB of RAM anymore. So you made me very curious about 2GB laptops retailing in 2022.
Edit: wow, why the downvotes guys? Is it against the rules to aske questions?
By the way, one of the buyers wrote that it is "great for studying" and another wrote that "it is confortable to use with Linux".
[1] https://www.dns-shop.ru/product/829ba65324bded20/133-noutbuk...
There are tons of refurbs, new-old stock and blatant lies on Amazon so you can really expect someone who doesn't know shit (eg only knows and bother about persistent memory, completely oblivious about RAM) can buy a device with 2Gb RAM in 2022.
Many people still buy those absolute bottom end of devices.
Why does my Macbook Air which cost me A$1,499(!) have soldered, unupgradable RAM?
I can SMD solder but it's still far too risky just to save a few hundred dollars
Of course they could just deaig and sell new motherboards with new chips for the older laptops chassis, like framework does, but knowing Apple, such user upgrades will not happen.
For example, an HP Elitedesk 800 mini (very small, so using SO-DIMMs and integrated everything - basically a non-portable laptop) will run you around 800 Euros, while the "equivalent" Elitebook 830/840 will run you 1500 euros. Specs are "similar", same generation mid-level i5, same RAM, same SSD. Main difference is the Elitedesk will have desktop-class CPU. Throw in a cheap HP screen (200 euro - Elitebook laptops have ridiculously bad screens, so that's fair), and you get to 2/3 the price of the laptop.
Apple is blatantly anti upgrade (just see the SSD situation on their desktop offerings) but that's not the only reason they solder stuff down.
I believe Dell is working on a new, open design for PCBs where this performance problem is smaller or even nonexistent. You lose the ability to do partial upgrades with the new system but gain the performance impact that is driving some companies to soldering down RAM for performance reasons.
For devices with slower RAM there is no excuse. Just an upsell to make you pay $100 for 8GiB of RAM.
Also, in cheap laptops soldered RAM often has lower speeds, same as replaceable one.
And if RAM has to be soldered, then the board with CPU, GPU and RAM could be made replaceable so that you can upgrade it later without buying a new device. Obviously, manufacturers don't want that.
Dell is on a new replaceable RAM standard. It's already been designed for their own products, but they're working with JEDEC to make it a standard: https://www.storagereview.com/review/dell-camm-dram-the-new-...
I also prefer upgradeable laptops over bleeding edge performance but the reality is that most consumers never upgrade their laptops (and if they do, only to add more storage). Until a large amount of customers start factoring repairability and upgradeability into their purchasing decisions, we'll only see soldered down RAM.
One such example is the HP Elitebook 1040 G9. The tablet-like version has soldered RAM, whereas the regular has external modules. They both use 4800 MHz DDR5.
For comparison, a cheap removable DDR4 module at 3200MT/s can provide theoretical bandwith around 25 Gb/s and two of them can provide 50 Gb/s which is also very fast (for me) and good enough for many tasks. More expensive DDR5 modules can provide up to 50 Gb/s bandwidth per module, and four of them give you 200 Gb/s of theoretical throughput.
So I don't see problems with using removable DDR5 modules. They are good enough, and being able to expand RAM cheaply is more important, than getting 2x bandwidth, that you cannot utilize, at a premium price.
<4GB devices are ~10.6% of the mix. 4GB are 20.8%.
Sure, I didn't play games on it. But for regular "office use" I never had any performance issue.
For my current laptop, I specifically wanted a model without a dedicated GPU. Didn't want the hassle of dealing with that (I run Linux) and also there was no reason for me to pay extra for something I don't need. It was cheaper for me to buy a dedicated GPU for my desktop.
But of course there are cheaper laptops with 4Gb RAM, so this one seems more like an exception. There are even tablets that cost less and have 12 Gb of RAM, although they are sold by suspicious sellers from China.
That's Bay Trail Atom. Launch date: Q1'14, two years after the platform launch, two years before the platform sees the latest release.
Or this is old new stock (of Bay Trail Atoms?) of something completely insane. Come on, 8 years! I had Acer W4-821 tablet with similar CPU in 2014! And was quite hampered by an upgrade to Win10, though I managed to run Virtual Box with CentOS on it to live test some code.
https://ark.intel.com/content/www/us/en/ark/products/80274/i...
There's absolutely no point in buying new cheap laptops these days.., Big businesses are always getting rid of 5 year old laptops because their 5-year warranty expired, and the prices get low because they're old, but those 5 year old laptops are comparable to 1 year old laptops these days, cause in 2017-2021 there has been 0 improvements in the laptop world...
I wanted to replace my top of the line 2017 Dell XPS 9560 in 2021 after 4 years of use and literally didn't find any laptop that was noticeably better to justify paying for it....
FF can do it, but it only triggers in low ram situations and detection is wonky, disabled on Linux.
I found the auto tab discard addon [0] to be a game changer on my low ram machine. It just works (though not on mobile).
[0] https://addons.mozilla.org/en-US/firefox/addon/auto-tab-disc...
Huh? When the system is getting close to running out of memory, isn't the least-recently-used memory swapped out to disk by the OS? And if you're using an SSD like nearly everyone these days, it isn't even noticeable.
Freezing tabs is a good idea to ensure the memory stops being accessed precisely so it can be swapped... but besides this, why not let the browser use all the memory it needs, and just let swap do its job? It seems entirely redundant for a browser to try to save memory by essentially implementing its own secondary swap strategy.
After all least-recently used memory is swapped out, the time comes to swap out recently used memory and it becomes noticeable, especially with a spinning disk with 400Kb/sec random write speed.
Swapping is extremely ineffective. Unloading a tab allows to use sequential write which is orders faster than random write even with SSD.
For keeping things open in the background that aren't being actively used, swapping is extremely effective.
I don't see any good reason why background applications should get swapped out by the OS, but background tabs should be handled by a different mechanism.
(And I have no idea what sequential write has to do with anything...? If you're talking about coming back to an old tab, loading it from swap will nearly always be faster than reloading over the internet, no?)
For HDD, sequential write speed can be 50 Mb/s and random write speed for 4Kb chunks can be as low as 400 Kb/s. For SSD, there is also a difference in speed on order of 50x.
Swapping uses 4Kb chunks and therefore uses the drive in the most inefficient mode. Alternative mechanism can employ faster and effective sequential access.
If swap needs to write 10 MB, in whatever chunk size, it will send them one after the other, just like the file system. Regular file systems don't have 100 MB sector sizes, either.
> For SSD, there is also a difference in speed on order of 50x.
I highly doubt that. Source: running fio on my SSD. SSDs actually can take advantage of parallelization, writing to multiple places at the same time, which a spinning drive obviously can't do.
This article [1] contains benchmark results for several SSDs and a good HDD. You can compare sequential read speed in fastest mode (SEQ1M) and random read speed in slowest mode (RND4K) and see that there is a huge difference for both HDD and SSD on order of 50x (for SSD) and 300x (for HDD).
HDD is very slow for random read/write access because it needs to wait until the desired sector will spin underneath the head, one spin takes approximately 10 ms, and on average you need to wait half of that time.
> For your HDD to reach that speed in sequential write, the free space should be contiguous.
If the file system is smart enough to allocate large chunks of free sectors then the write will be sequential. If there are no large contiguos chunks then maybe you need to defragment your drive using standard Windows tools (don't know if there are similar tools for Linux) otherwise write speed will be very low.
> SSDs actually can take advantage of parallelization
This doesn't matter when you need to swap pages in because you retrieve one page after other and cannot parallelize this (as pages are swapped in only when they are accessed by the program).
But I can agree that buying $30 SSD is probably the cheapest way to speed up an old computer.
[1] https://glennsqlperformance.com/2020/12/13/some-quick-compar...
It would seem that Linux swap uses the block device layer to handle actual I/O for swap. So, I think that if it only needs to write or read one single page at a time, then sure, it will be slow. But if you need to swap out a sizeable quantity of memory (meaning multiple pages), it will need to write or read multiple pages "at a time". Linux also tends to group pages together. Since reading and writing is async [0], as soon as the io operation has been sent, the next page will start to be handled, even if the actual io to disk hasn't finished. So, in practice, it's very likely that there are several IO operations happening at the same time from the drive's point of view.
The system is also highly likely to be doing some unrelated I/O, which is why parallelism helps a lot.
This is where the SSD will shine, because it will absolutely be able to handle multiple small IOs in parallel [1]. And also where, presumably, queue-ordering in the case of spinning drives can help here, too, by optimizing the order in which the paging operations will occur.
I'm not familiar with Windows, but I'd expect things to work somewhat similarly, especially since the swap is backed by an actual file system (but I don't know if the swap files have any properties that make it "special" - though I wouldn't be surprised for that to be the case).
---
[0] https://www.kernel.org/doc/gorman/html/understand/understand... look for heading 11.7
[1] See RND4K / Q32T16 in your benchmark, where the factor is only 2.
The only performance issues that are actually relevant here are if you get into thrashing because you've run out of memory totally (no longer pre-emptive), but that doesn't happen in normal usage. Or when you're swapping memory back in for an app/page that's scattered among many 4 KB pages on disk... but the point is that should still be faster than reloading the page over the internet! (And on SSD's it's blazingly fast since fragmentation on disk barely even matters.)
I don't think so. HDD can do approximately 100 IOPS, and with 4kB pages that gives you speed of 400Kb/s.
I had different cases when system worked poorly when there was not enough RAM. All of these happened to me on 4Gb Linux system:
- when a heavy page is opened in Firefox and it tries to allocate more than 500 Mb of RAM (for example, Google Street View that leaks RAM), the system swaps out Gnome desktop compsitor, and everything freezes for several minutes, you cannot even move a mouse or switch to a text console. Often the only solution is reboot. Why cannot Linux protect Wayland compositor from being swapped out I don't understand.
- when the system turns off the screen, it can swap out desktop compositor because it is not used, and there is a freeze for 20-30 seconds when you try to wake up the system. Why cannot it swap out something less important I don't understand.
So in practice swapping can produce long freezes when the system becomes completely unresponsive. I cannot agree with your statement that getting a page from swap is faster than loading from Internet.
If instead of swapping separate pages the system swapped out and in whole processes, the situation might be better.
By the way, out of curiosity I tried to investigate who uses so much memory that 4Gb becomes not enough by summing PSS (proportional set size) of processes, and I never got 4Gb used, it always was about 2.6-2.8 Gb used after which the system becomes prone to sudden freezes. "free" command also never showed number of "used" RAM above 3Gb. I guess Linux has not only issues with swapping, but also with counting used memory as well.
And I was clear I wasn't talking about severely underprovisioned machines, such as you are describing. In normal usage where background apps/tabs are swapped out preemptively, there is no performance hit at all. And then when they're reloaded from swap -- yes, it's extremely fast. It's like loading a web page from your local drive, only even faster because it doesn't have to be interpreted.
If you're dealing with freezes of 20 seconds to several minutes, your machine is severely underpowered or somehow seriously misconfigured. You need to upgrade, not complain about how swap doesn't work.
I would much rather incur a swap load time than a page refresh.
Seems like a reasonable bar to test against. 2GB even a decade ago was very low end.
1: Load NBC.com (or any other regular media site) in a "naked" web browser (just a plain browser, no ad blocking, noscript etc)
2: Open dev tools -> networking tab
3: Study the activity, look at requests made, size of requests, data the requests contain (remember, YOU are paying for these requests in terms of impact to battery, bandwidth, electricity usage etc)
I can see MB's of data transferred from my device, every time I scroll more network activity is performed (100's of requests per MINUTE), this is all made possible by "JS" which is the single biggest resource hog of any modern browser.
Turning JS off (whilst obviously crippling some pages) results in HUGE savings of bandwidth, reducing battery impact AND increasing privacy :). (You can also use noscript to allow/deny certain scripts from loading, and you'll be surprised how many pages work with JUST the root domain enabled, thus every third party script is not vital to the functioning of the page)
I seriously think modern browsers (including Firefox) need to implement features to reduce the amount of network requests a page can make, including to third party websites, and limit the amount of data a single page can consume. I'd call it a "browser firewall" similar to tracking mode, preventing third party requests entirely
Data does cost, contrary to what others make think, especially on mobile lines when out and about.
So yeah, let's fix that first.
Since I upgraded a couple days ago, I'm seeing that indeed every tab completely reloads when I switch to it if I haven't used it in a few hours.
But now I'm kinda worried that I'll leave something half-written and it'll be gone. Unfortunately there doesn't seem to be any way to test that in advance without waiting a few hours.
I also often rely on a long article being scrolled halfway through to save my place, or a long video I'm in the middle of, and I'm worried that my spot will be lost as well.
I find it extremely odd that they're not even mentioning anything about that -- e.g. whether you will lose data/place and you should disable this feature if that's unacceptable, or whether it does some fancy stuff to restore the state of anything that's a form, contenteditable, scroll position, or playback location.
There should be a middle ground that can pause all resource use, and then resume it, without reloading state. Google, Amazon, Twitter, Youtube subframe/embeds are resource hogs.
So many times a page has an infinite paint loop that sucks 100% of a cpu core, and I with I could just… turn the dial down a bit to save the battery.
Here’s hoping that energy saver lives up to its name.