What is the bottleneck for software performance?

I have Waydroid installed on my Librem 5 and was surprised to find that not only does it work pretty well (limitations like Bluetooth and camera notwithstanding), but actually it mostly performs far better than PureOS. Apps load much faster (this is especially noticeable with Firefox but seems true in general), app scrolling is generally smoother etc.

Clearly then hardware is not the limiting factor, and presumably firmware/graphics drivers aren’t either. So when people talk about optimising the software is there a general bottleneck? GTK? Libadwaita? Something else? Or does each app need individual optimising?


The exact answer would probably be a whole long paper, but I guess a good chunk of it can be answered by:

  • GTK3 is software rendered
  • GTK4 GL renderer could probably still learn some tricks on how to perform well on embedded GPUs
  • aside of the web engine, Firefox for Android is a completely different codebase than the desktop one

Thanks @dos I was hoping you would answer. Does the GTK4 GL renderer explain app start up time as well? It’s far more noticeable on the PinePhone than the L5 but it’s slow ish for more or less all apps on the L5 too (e.g. ~2 seconds for chatty, contacts or console, 6-7 seconds for Gnome Maps etc)

1 Like

I noticed this too, that Andriod WebView in a container scrolls very smoothly; faster than native Firefox.

A shocking amount of work is done just to scroll a pixel up or down. Smart phone apps and their libraries are optimized for touchscreens, which means scrolling with extra low latency. If the image under your thumb is jumping around, it does not feel right. Historically, desktop operating systems tend to have less frequent scroll events and were never intended to redraw their page more than a few times a second.

I am not sure what the solution is to this. Certainly, having the app draw more than what is visible to the GPU, and letting the GPU move that image around by relying on the CPU to send new coordinates to the GPU is much faster, but I am not sure if that is what is happening.

Gnome also uses javascript and css. Which are slow. I don’t know what Phosh uses, but it is built on top of gnome so I assume it has many of gnome’s downsides.

The three bottlenecks for any computer, - even though they are hardware - are 1) Memory, 2) I/O, and 3) CPU.

Given that the question is software, it could be anyone’s guess. It could simply be written badly. Maybe it grabs more memory than it needs? Are the data elements not aligned (resulting in memory leaks)? Re-reading the same data elements from disc (and not memory) causing more I/O?

The above is discounting external communication since this is a phone. External communication has its own I/O pause factor. If you data is in a cloud for example.

I think it’s a combination of things. Android draws everything using UI, which is much faster on its own, but it also leaves much more CPU free for other tasks.

Android OS, it’s libraries and applications have been specifically refined for decade and a half to work on mobile devices, while software we’re using has not been able to receive that kind of treatment, because of time, budget, and manpower constraints. As @dos already mentioned, Firefox for desktop and Android have completely different codebases, GTK3 renders using CPU, and I’m sure that we can find more examples of libraries and apps that are just not refined enough for constrained resources.

In software development, we usually first make it work, and then optimize as necessary. Some of the software just didn’t come to that point yet.

Bottlenecks depending on use cases. For me and my PC it’s VRAM and GPU, for others it’s CPU-Cache or temperature (like Librem 5 or PCs with NVMe SSDs and heavy storage use cases).

I was quoting textbook. One could contend that all use cases still boil down to the original three:

VRAM is still memory.
GPU is still another type of CPU.
NVMe is still I/O.
SSD although it is not disc, it plays the I/O role though much improved.

Back to software, software has to work with it, efficiently or inefficently.

Recall the days when software was optimized to work with 64K (or less) of memory? Once that was overcome, software bloat entered in. Ask anyone today to write in 64K or less.

Or when the ferrite memory core market crashed when semiconductors were invented, arrrgh!

1 Like

I see so many differences that I don’t even want to start explaining it (hardware is off-topic here, so I want to make it short). :smile: However, I got your point, but temperature is still another one.

1 Like

Was mostly curious if the developers here already know of a specific bottleneck, particularly regarding app loading time - which I assume is an acknowledged issue since splash screens were introduced to compensate for it.

As I said it doesn’t seem like hardware is the limiting factor, most if not all of the apps involved are GTK4 so I assume GTK3 isn’t relevant (unless Phosh is doing something slow during app loading?). Gnome uses JS, but this is Phosh not Gnome Shell and apps are a mix of C, Rust, Vala, Python and JS and this seems to affect them all to some degree?

I suppose I should figure out how to profile it but essentially I’m curious what’s happening at app load time that means they’re all so much slower to load than android apps on the same device.

1 Like

I don’t disagree since I’m old. I get your point too. Time has marched on for me.