by codedokode · 4y ago · 0 comments
Let's say I am visiting a properly made website and it takes 10% of CPU to render. Even if browser devs make their browser twice faster, it will only save 5% of CPU time - and that would be completely unnoticeable. You might ask, what about modern websites, built with D*t compiled to webassembly, GPU acceleration, reactive frameworks, material design and capable to load the multi-core CPU at 100%? I am not using such sites so I don't care.
Now let's look at memory usage. Optimizing for speed usually causes increased memory consumption, and this increases the chance of invoking swapping. If the system starts swapping, it becomes orders of magnitude slower. No speed optimizations will matter in this case.
Therefore if you are targeting wide audience, and not only mac users, then you should be optimizing for memory usage. If the browser could use two times less memory while using twice amount of CPU time that would be perfect. Just think how many laptops with 2 or 4 Gb of RAM would become usable again.
> You might ask, what about modern websites [...] I am not using such sites so I don't care.
They might be optimizing the wrong thing for you, but the majority do use "modern sites"
Does this just mean that browser developers are optimizing for the right thing, just not something that benefits you? Tons of people use these sites.
> If the system starts swapping, it becomes orders of magnitude slower.
Not really. Browsers try to keep stuff in swap that they probably won't need. Swapping doesn't become a problem until you're almost out of memory as well, and then you might get thrashing. But there's a wide range where CPU optimizations make sense. And such a large fraction of people have SSDs that even swap access can be pretty fast.
As much as I want them to optimise for memory usage. Taking less CPU time for rendering is extremely important for battery.
Not to mention faster site is noticeable. And that is what sells. Chrome was faster than everything else when it launched. ( May be apart from Opera )
In reality it is complicated when we have extra CPU cycle to burn developers tends to put fancy new things. Which is basically what andy giveth bill taketh away.
Of course, having turned browsers into virtual machines, there isn't much specialisation that can be done without breaking things. Might it be time to create a subset of features that sites could limit themselves to and allow browsers to use a simpler and faster render pipeline? You know, like what we thought AMP was going to be before it turned out to have Google's monopolistic shit smeared all over it.
Of course, having turned browsers into virtual machines
I really wish browsers would take that one extra step and utilize their intimate knowledge of what memory allocations belong to which sites that are actually active and implement paging to disk instead of gobbling up ram like it is a infinite resource and expecting the general purpose OS to figure it all out.And given a choice between being able to open several tabs all of which are barely functional and being stuck on a single website at at time which runs smoothly I'd definitely choose the later (of course the tradeoff is probably not as straightforward, then again it's not completely obvious to me that optimizing for speed would necessarily result in higher memory consumption).
IMO even if they are optimizing for Macs, I'm not sure this approach would make sense (assuming the tradeoff between CPU performance and RAM usage exists) since they are much more likely to have less memory and better CPUs than PC laptops (e.g. you can probably easily get a Windows laptops with 32GB for $1000 or less).
Do you have any graphs/charts/tables to substantiate the claim that high memory usage is power hungry enough to be optimized for vs CPU?
Perhaps you meant storing and fetching from memory lots impacts battery life?
It is like when people say page fragmentation in SQL Server isn't important any more because random access is so fast due to SSDs and other IO subsystem improvements – pages are held in RAM in the storage format so if they are only ⅔ filled you are wasting ⅓ of the allocated memory which can have significant performance effects if your common working set is not smaller than the memory available. Though in fairness, I would agree that this issue is usually quite far down the list of things that need addressing in poorly performing database & applications.
Lol, no?
If your benchmark is memory bound, reducing memory usage is probably the simplest way to make it faster.
Java for example uses runtime VM information before it starts compiling classes to machine code. That means it's faster in the long run, but requires a 'warm up time'. Obviously a bit better for server side.
Plus, most laptop manufacturers rip you off for every RAM spec bump. $400 - $500 to go from 16GB to 32GB?! They can f--k right off!
Not everyone is making six figure SV salaries to not flinch at these prices. That's why I love the framework laptop.
That'd be 90-150€ for upgrading average Thinkpad for me, depending on starting configuration.
The former lasts over 2 weeks in S3, the latter not even a week.