I Made a WebGL App That Measures Device Performance
Hello. I'm Hirayama from the Technology Department.
In this article I'll introduce a benchmark program I threw together, and along the way cover:
- The circumstances that make you want to write a benchmark program
- The design of the tests, and the hardware behind them
You can run it on the web here (you can also click the screenshot above). Because it's built with Unity's WebGL, it can be run on lots of machines without any extra hassle. However, it uses WebAssembly, so it doesn't run on iOS 9 or earlier. Sorry about that.
If you measure your device, I'd be very happy if you sent me the results (a screenshot) on twitter. Game consoles, high-end PCs, old smartphones and so on are especially welcome!
The source code is also on GitHub.
How to measure
Press "ALL" and leave it alone until it returns to the original screen (until the character's picture appears). If the device goes to sleep or the app goes into the background along the way, it can't measure accurately. On a PC it stops whenever the window loses focus, so I'm sorry to ask, but I recommend running it during a break or the like.
It doesn't show flashy visuals like the major benchmark software does, so you won't get that "look how fast my device is" thrill. It's meaningless unless you understand what the numbers mean and what each test is for; it's strictly for game development pros.
Motivation
For about 15 years I made games for home consoles and arcades. The actual hardware was naturally right there in front of me, so I could find out what it could do and how much, and the manufacturer's documentation described its strengths and weaknesses in detail.
In the smartphone world, though, it's a completely different story. First of all, the game has to run even on machines you don't have on hand. And there are so many machines that even if there were documents about the hardware, you couldn't possibly read them all.
There is information about Unity along the lines of "doing this is heavy", but most of it is about the CPU side, there is little quantitative information about "how heavy", and we don't really know how capable the machines are in the first place. For the last two years or so, my approach has been the haphazard "build something any old way, and optimize once it feels heavy".
So, belatedly, I decided to measure. What separates amateurs from professionals is whether you can make quantitative judgments, and I feel that gathering quantitative information is the very first thing you have to do.
Why make my own?
With existing benchmark software, I can't really tell what it measures or how. I don't understand what the resulting numbers mean either. We're developers, so results don't really click for us unless the test comes with source code, and we want units on the numbers, like "gigabytes per second" or "pixels per second".
Also, if you measure with a game you developed, you learn that game's load, but the numbers are hard to apply to other games. If you want to make use of them in the games you build from now on, something that measures more fundamental performance is better suited.
Results
Let's get straight to the results.
These were measured with version 0.2.4 and may not be comparable with other versions. On top of that, the measurement error is large, and results may vary with the OS, battery level, thermal state, browser and so on. Please think of them strictly as "something for getting a rough idea". The details of each test come later.
CPU side
I prepared four tests. The unit is seconds: "how many seconds it took to finish the calculation". Smaller is better. WebAssembly performance depends heavily on the browser, so I also list the browser name. For reference, I also list when each machine was released.
| Machine | Browser | Released | FibonacciInt | FibonacciFloat | HeapSort | QuaternionIntegration |
|---|---|---|---|---|---|---|
| i7-8700K,GeForceGTX 1080 | chrome | 2016/5 | 0.037 | 0.047 | 0.774 | 0.314 |
| MacBookPro15'' | chrome | 2015/5 | 0.050 | 0.057 | 1.07 | 0.393 |
| MacBookPro13'' | UnityEditor | 2014/7 | 0.473 | 0.537 | 4.18 | 1.37 |
| MacBookPro13'' | chrome | 2017/X | 0.049 | 0.059 | 0.998 | 0.313 |
| MacBookPro13'' | chrome | 2014/7 | 0.091 | 0.133 | 1.67 | 0.462 |
| iPhoneX | chrome | 2017/11 | 0.149 | 0.141 | 1.41 | 0.409 |
| PH-1 | chrome | 2017/8 | 0.190 | 0.198 | 3.60 | 1.52 |
| XperiaXZ premium | chrome | 2017/6 | 0.194 | 0.198 | 3.63 | 1.49 |
| iPad mini4 | safari | 2015/9 | 0.243 | 0.239 | 3.58 | 0.881 |
| XperiaZ5 Compact | chrome | 2015/10 | 0.321 | 0.403 | 5.58 | 2.60 |
| Nexus5 | chrome | 2013/10 | 0.337 | 0.364 | 6.04 | 2.38 |
| iPhone6Plus | safari | 2014/9 | 0.605 | 0.690 | 7.77 | 2.21 |
| AndroidOne S2 | chrome | 2017/3 | 0.709 | 0.725 | 9.48 | 5.22 |
| 404KC | chrome | 2015/2 | 0.815 | 0.887 | 9.22 | 5.87 |
The top one is a desktop PC, the next three are laptops, and the rest are smartphones and tablets.
GPU side
There are six tests on the GPU side. The unit is megapixels per second, that is, "how many pixels it can fill in a given time". Bigger is better.
| Machine | Color | ColorZ | AlphaTestColor | HeavyCalc | CoherentTexture | IncoherentTexture | DependentTexture | OpaqueColor |
|---|---|---|---|---|---|---|---|---|
| i7-8700K,GeForceGTX 1080 | 4490 | 4010 | 4740 | 1430 | 4360 | 281 | 4330 | 4410 |
| MacBookPro15'' | 279 | 256 | 466 | 75.1 | 190 | 14.0 | 190 | 483 |
| MacBookPro13''(Editor) | 85.6 | 63.8 | 155 | 32.0 | 47.7 | 13.0 | 47.8 | 170 |
| MacBookPro13'' 2017 (Chrome) | 294 | 272 | 474 | 64.2 | 199 | 28.0 | 188 | 442 |
| MacBookPro13'' 2014 (Chrome) | 88.5 | 77.5 | 167 | 37.0 | 54.6 | 14.0 | 54.7 | 217 |
| iPhoneX | 993 | 946 | 508 | 37.9 | 450 | 5.00 | 339 | 4100 |
| PH-1 | 428 | 420 | 365 | 32.0 | 211 | 2.97 | 206 | 428 |
| XperiaXZ premium | 429 | 422 | 366 | 32.0 | 187 | 2.08 | 181 | 430 |
| iPad mini4 | 148 | 147 | 81.5 | 8.97 | 120 | 1.99 | 112 | 655 |
| XperiaZ5 Compact | 366 | 282 | 358 | 30.0 | 134 | 1.99 | 128 | 257 |
| Nexus5 | 117 | 116 | 58.0 | 10.0 | 68.0 | 1.96 | 68.0 | 117 |
| iPhone6Plus | 144 | 144 | 78.9 | 8.30 | 95.3 | 1.85 | 85.5 | 641 |
| AndroidOne S2 | 22.9 | 18.2 | 6.20 | 1.02 | 15.4 | 0.94 | 12.8 | 23.9 |
| 404KC | 18.0 | 18.0 | 5.01 | 0.98 | 15.0 | 0.96 | 12.8 | 18.0 |
What we can tell
First, here's what's clear at a glance.
- The desktop PC is, as you'd expect, in a different league for speed
- They're all "smartphones", but their performance is worlds apart. We're talking differences of tens of times.
- Newer doesn't mean faster. The 404KC is from 2015 and the S2 from 2017, but they are slower than the 2013 Nexus5.
I'd had a vague sense of this ever since making a game (our company's "Tokyo Prison") , and opinions like "it's fine as long as it runs on a three-year-old device" always felt off to me. In the GPU world, cheap stays cheap forever, and it is common for a cheap one to still lose to an old high-end one five years later. In fact, we saw things like an old iPhone5 running at over 40 frames per second while a freshly bought S2 couldn't even reach 25. These tests make that very clear.
The poor performance of the 404KC and the S2 stands out, but it is dangerous to think of them as "exceptionally weak machines". Both the msm8917 in the S2 and the msm8916 in the 404KC are chips used in many devices. Have a look at the Wikipedia article on Snapdragon.
You might say, "We took device statistics from our existing games, and there are hardly any machines like that", but that may just be the result of "people with those machines can't play because it's too heavy".
When everyone on the team uses high-end phones like the iPhone, I think it's easy for their sense of what's normal to drift. How ordinary people choose which smartphone to buy is a pretty important perspective, don't you think?
CPU tests in detail
Now let me explain the tests in detail, starting with the CPU tests.
FibonacciInt
By calculating Fibonacci numbers, this measures the performance of integer arithmetic and branching with almost no memory access. It doesn't have to be Fibonacci numbers, and the details of the code don't matter, but if you're interested, take a look at the code.
What I want to see here is raw CPU performance. I want to remove the influence of memory performance as much as possible, so what suits it is a workload that does a lot of computation for the amount of storage it uses. Still, something like "increment by 1 a hundred million times" might become blazingly fast depending on compiler optimizations, which is scary (it could turn it into +=100000000, for example). So it has to be something that inherently needs a lot of computation (= has a large order of complexity) or is hard to optimize mechanically. The traveling salesman problem and naive Fibonacci have exponential complexity, so they fit. Integer addition and subtraction, comparisons, branches and so on run at high density, and the memory the calculation needs is at most about 4 bytes × 40, so it all fits in the CPU's cache.
Let's look at the results.
| Machine | Browser | Released | FibonacciInt |
|---|---|---|---|
| MacBookPro13'' | UnityEditor | 2014/7 | 0.473 |
| MacBookPro13'' | chrome | 2014/7 | 0.091 |
| AndroidOne S2 | chrome | 2017/3 | 0.709 |
| iPhoneX | chrome | 2017/11 | 0.149 |
| Nexus5 | chrome | 2013/10 | 0.337 |
| XperiaXZ premium | chrome | 2017/6 | 0.194 |
First, the PC: running it in the Editor is about five times slower than WebGL. I'd had a hunch that "running in the editor gives you about the speed of a cheap smartphone", and this seems to back it up. It's not much different from the S2. So doing some quick profiling in the editor is actually helpful.
We can also say that high-end machines are fast. Even the old Nexus5 beats the S2 by a wide margin. High-end machines like the iPhone, Xperia and Nexus5 carry a small number (about two) of "high-performance CPU cores (Cortex-A9, A15, A57 and so on)", while cheap ones like the S2 carry more (4–8) "low-performance CPU cores (Cortex-A5, A7, A53 and so on)". If you could draw out the performance of all the cores, the cheap ones could put up more of a fight, but making full use of multiple cores in Unity is hard, so for now single-core performance is what matters. That may change once building with ECS becomes the norm, but that will still take time. It's worth remembering that "the A53 is slow".
FibonacciFloat
This simply computes the Fibonacci numbers in float. I wanted to see "the effect of mixing floating-point arithmetic into integer operations like branches and increments", but there doesn't seem to be much difference.
You can see a tendency for PCs and Android devices to be slightly slower than with integers, and for iPhones to be the same or, conversely, slightly faster, but it's marginal. For floating-point performance, another test shows the difference more clearly.
HeapSort
Simply a heap sort.
When it comes to sorting, quicksort is the one everyone thinks of. Quicksort is a nuisance in many ways, but its performance is the best because of the property that "it frequently operates on data that is close together in memory". The data tends to stay in the cache and be handled entirely inside the CPU, so there is little waiting on memory operations.
Heap sort, on the other hand, is an easy algorithm to work with, but in actual speed it is far behind quicksort. Why? Because "it frequently operates on data that is far apart in memory". The cache can't be used effectively, and the waits for memory operations get long. Put the other way around, it lets us measure CPU performance including memory access. A machine with a large ratio between Fibonacci and heap sort is a machine whose CPU is fast relative to its slow memory.
For example, look at the following.
| Machine | Browser | Released | FibonacciInt | HeapSort | Ratio |
|---|---|---|---|---|---|
| iPhoneX | Chrome | 2017/11 | 0.149 | 1.41 | 9.5 |
| XperiaXZ premium | Chrome | 2017/6 | 0.194 | 3.63 | 19 |
Let's compare high-end models released at about the same time. The iPhone is simply faster, but look at the ratio. The Xperia's is 19 and the iPhone's is 9.5, so it smells like the iPhone spends relatively more on memory (though I can't say for sure from such a rough test). If so, the Xperia is weaker at "calculations that use a lot of memory". In C#, complex data structures of classes linked by references scatter memory all over the place, which puts machines with slow memory at a disadvantage. The optimization of packing data into arrays works on any machine, but the weaker the machine's memory, the bigger the improvement.
iPhones are expensive, and maybe that's because their memory is high-end. Even if there's no difference in CPU clock speed or core count, a difference in memory performance leads to a big difference like this.
There was once a time when game consoles could only carry a tiny amount of memory. Game consoles placed great importance on memory speed, but fast memory is expensive, like real estate right next to a train station, so they couldn't carry much of it. Back then games were made to fit the machine, so you could get by with little memory. Smartphones, on the other hand, are general-purpose computers. Software isn't made to fit the machine, so cutting capacity isn't an option. As a result, they inevitably choose "plenty but slow". Incidentally, game consoles since 2010 have also come to lean toward capacity over speed in their design, as the share of games released on multiple platforms rose and they were required to carry an OS, a browser and so on.
QuaternionIntegration
This measures floating-point (float) arithmetic performance. I reused, as is, some quaternion integration code I'd written for something else. It repeatedly calculates on a very small amount of data, so it is hardly affected by memory, and it has few branches, so it can measure pure floating-point calculation performance.
As with heap sort, looking at the ratio to Fibonacci reveals each chip's character. It tells you how much importance the chip places on floating-point arithmetic.
| Machine | Browser | Released | FibonacciInt | QuaternionIntegration | Ratio |
|---|---|---|---|---|---|
| iPhoneX | Chrome | 2017/11 | 0.149 | 0.409 | 2.7 |
| XperiaXZ premium | Chrome | 2017/6 | 0.194 | 1.49 | 7.68 |
The iPhone and the Xperia, which have similar integer performance, differ greatly in their ratios: 2.7 and 7.68. I suppose the iPhone treats floating point as important, and the Xperia doesn't.
This part looks like it could affect games quite a bit. I hear Unity currently does skinning (vertex blending) on the CPU, and when you move tens of thousands of vertices every frame, floating-point performance has a direct effect. It might be good to actually measure performance with Unity's skinning.
GPU tests
Now let's look at the GPU tests.
Every test shows how many full-screen draws each shader can do into a 1024x1024 RenderTarget in 40 ms.
How many screens you can fill in an actual game depends on the situation. For example, if you make a 60 FPS game you have to fit in 16.6 ms, so 5/12 of the score is the limit of the area you can fill. In other words, with a score of 120 you could fill 1024x1024 120*5/12 = 50 times.
Color
This fills in solid red with alpha blending enabled. The fragment shader is as follows.
fixed4 frag (v2f i) : SV_Target
{
return fixed4(1.0, 0.0, 0.0, 0.5);
}
Why test with alpha blending enabled? I'll explain later in the section on the OpaqueColor test.
The purpose of this test is to measure only the performance of writing to the render target. There are 4 vertices per draw, so reading vertex data from memory or vertex shader calculations will never be the bottleneck. Also, the data passed from the vertex shader to the fragment shader is a single float4, like this:
struct v2f
{
float4 vertex : SV_POSITION;
};
so transferring and interpolating it probably isn't a bottleneck either. That means we can measure purely the performance of writing from the fragment shader to the render target.
However, alpha blending is enabled, so it takes three steps:
- Read the current pixel from the render target
- Linearly interpolate it with the output color
- Write it to the render target
so we can't measure just simple write performance. The render target is RGBA32, so it reads 4 bytes, interpolates, and writes 4 bytes. 1024x1024 is 4 MB, so each time it draws one, there is 4 MB of reading and 4 MB of writing. If the score is 100, there are 400 MB of reads and 400 MB of writes every 40 ms, and per second, multiplying by 1000/40 = 25, that's 10 GB of memory access, reads and writes. That means the memory must be at least that fast, so you could say this test is looking at memory performance at the same time.
Now, let's look at the results.
| Machine | Color |
|---|---|
| iPhoneX | 993 |
| XperiaXZ premium | 429 |
| Nexus5 | 117 |
| AndroidOne S2 | 22.9 |
A 50-fold difference in performance between cheap and high-end machines is pretty tough to deal with, because we sell the same product to both regardless. Also, a high-end machine stays high-end even as it gets old: the 2013 Nexus5 has five times the performance of the 2017 S2.
By the way, I wrote that this test also looks at memory performance, but isn't the iPhoneX a bit too fast? I wrote earlier that "fast memory is expensive and you can't carry a lot of it". It's hard to believe it carries gigabytes of memory that is 50 times faster, right?
When something like this happens, there's usually a trick behind it. The iPhoneX is probably hardware that can do alpha blending without memory access. A technique called tile-based deferred rendering (TBDR) makes this possible. I'll write about it in detail later.
ColorZ
Almost the same as Color, but with Z testing and Z writing enabled. The Z buffer is probably 32 bit, so the load grows by 8 bytes in total: 4 bytes to read and 4 bytes to write. It is even more strongly limited by memory performance.
| Machine | Color | ColorZ |
|---|---|---|
| iPhoneX | 993 | 946 |
| XperiaXZ premium | 429 | 422 |
| XperiaZ5 Compact | 366 | 282 |
| Nexus5 | 117 | 116 |
| AndroidOne S2 | 22.9 | 18.2 |
The top three have barely slowed down. Either they have memory performance to spare so it doesn't hold them back, or there's a trick like the TBDR mentioned above. Which is it?
On the other hand, the cheap S2, and the XperiaZ5 Compact, which is supposed to be high-end, clearly lose performance. Maybe the memory is holding them back, or maybe the Z test processing itself is slow.
AlphaTestColor
This is Color with a discard instruction added. When you call discard, that pixel is not drawn. In most cases discard is used to implement a process called the "alpha test", which skips drawing if the alpha value is below a certain level.
fixed4 frag (UNITY_VPOS_TYPE vpos : VPOS) : SV_Target
{
vpos.xy *= 1.0 / 128.0;
if (frac(vpos.x + vpos.y) < 0.5)
{
discard;
}
return fixed4(1.0, 0.0, 0.0, 0.5);
}
It branches on whether to discard based on vpos.

vpos.xy holds the pixel's coordinates as integers. Divide them by 128 and the fractional part climbs from 0 to 1 over and over, once every 128. Branching on whether it is below 0.5 gives you this diagonal pattern. It doesn't branch on the alpha value, so it isn't really an alpha test at all. I picked the wrong name.
Now, the results.
| Machine | Color | AlphaTestColor |
|---|---|---|
| MacBookPro13''(Chrome) | 88.5 | 167 |
| iPhoneX | 993 | 508 |
| AndroidOne S2 | 22.9 | 6.20 |
Comparing with Color shows how bad each machine is at discard. For example, the iPhoneX drops to about half. The S2 is even worse at it, falling to less than a third. I can't tell whether it's bad at discard or slow because of the extra calculation, but the calculation is only four or five instructions, so it's probably the discard. On these machines, it may be faster to just paint with alpha 0 than to discard.
On the MacBook Pro, however, it's about twice as fast. It discards almost half the area, so it seems we can say "it got faster by exactly the amount it didn't have to paint". Intel's GPUs must have that characteristic. This kind of thing also differs from GPU to GPU.
Still, however bad a machine is at alpha testing, when you need it, you have no choice but to use it. For example, if you want the result of drawing billboards to be reflected in the Z test, you need the alpha test, because even if you paint with alpha 0, it still writes to the Z buffer. If discard is extremely slow, giving up billboards even at the cost of more vertices is also an option.
HeavyCalc
A test that just makes it do a huge amount of calculation. It doesn't read textures, so it's hardly affected by memory performance, and you can estimate raw computing performance. It has the same purpose as Fibonacci on the CPU.
What the shader calculates can be anything, but, as with Fibonacci, it's no good if the calculation looks like it might be optimized away. The details are just a hobby of mine, so I'll skip them, but it produces a picture like this.

Let's look at the results.
| Machine | HeavyCalc |
|---|---|
| i7-8700K,GeForceGTX 1080 | 1430 |
| MacBookPro13''(Chrome) | 37.0 |
| iPhoneX | 37.9 |
| XperiaXZ premium | 32.0 |
| Nexus5 | 10.0 |
| AndroidOne S2 | 1.02 |
The GeForce is overwhelming at over 1000, but smartphones manage 40 at most. The MacBook Pro is at the same level, so for those of you using Unity on a laptop, GPU performance in the Editor shouldn't be very different from a high-end smartphone.
The S2 shows about 1, but please read this as "less than 2". The current implementation isn't very reliable when the result is 2 or below. "Weak, anyway" is good enough.
Now, it's worth keeping in mind that even within the category of "smartphones", computing performance differs by 40 times. When you make something for multiple devices, the basic rule is to target the bottom. Otherwise you take on a huge risk. Whether you settle for higher resolution or frame rate on high-end machines, or put in the work so that they show a different picture, depends on the nature of the product and how particular the developers are.
CoherentTexture
It simply applies a texture. What it looks at is "memory read performance in a situation where the data stays in the cache".
fixed4 frag (v2f i) : SV_Target
{
fixed4 c = tex2D(_MainTex, i.uv);
c.a = 0.5;
return c;
}
Memory access is normally done in chunks of, say, 32 or 64 bytes. If you're buying two ice creams at a convenience store, you'd buy both at once. You don't want to buy one at a time and make two trips. It's the same thing.
If processing some pixel reads, say, 64 bytes, that also contains the data for the neighboring pixels, and it goes into the cache. When processing the neighboring pixel, it only has to read from the cache, so there's a high chance no memory access happens. If you apply a texture normally, this is almost always the case, so you can measure "performance when memory is accessed cleanly".
For example, say we put the whole of a 1024x1024 texture on the screen. The total size is 4 MB. If there were 4 MB of cache memory, no memory access at all would happen from the second time on, so the total memory read would be just 4 MB.
In reality, though, the cache probably isn't that big, so it will likely read the whole thing every time it draws. If the score is 100, that adds 400 MB of reads, and multiplying by 25 to get the per-second figure gives 10 GB. So we can say it probably has performance on the order of 10 GB/s.
Of course, it doesn't measure memory alone; the load of the tex2D instruction itself is also involved. That probably includes the load of texture filtering. In this test the filter is set to bilinear, so if applying the bilinear filter were slow, the score would drop because of it (though I've never seen a machine that can't do bilinear on ARGB32 for free).
Let's look at the results.
| Machine | Color | CoherentTexture |
|---|---|---|
| i7-8700K,GeForceGTX 1080 | 4490 | 4360 |
| iPhoneX | 993 | 450 |
| XperiaXZ premium | 429 | 187 |
| Nexus5 | 117 | 68.0 |
| AndroidOne S2 | 22.9 | 15.4 |
How much it drops compared with Color differs by machine. The iPhoneX and XperiaXZ fall to less than half, but the S2 and Nexus5 don't fall as far as half. The GeForce barely drops. I suspect whether there's memory performance to spare is the big factor, but to know for sure would take another test. In practice, though, it's probably fine as long as we know "the slowest one can only fill about this much".
Now, "apply a texture, alpha blend it and output it" is the most frequent operation in 2D games. So the results of this test are useful for estimating how much you can do in an actual game.
For example, consider making a 60 FPS game on the S2. Multiply 15.4 by 16.6/40 = 5/12 and you get 6.42. Painting 1024x1024 six times is already the limit. What's more, the screen resolution isn't 1024x1024. 1280x720 is smaller than 1024x1024, so that's fine, but at 1920x1080 the pixel count doubles, so three times is the limit.
With this in mind, on Tokyo Prison we aimed for an average overdraw of about 3 in situations where we wanted frame rate. That said, this is practically impossible. A slightly large effect, a cut-in, or a pop-up window adds one or two screens' worth just by itself. In that case, lowering the resolution is the easiest fix. Our Tokyo Prison lets you lower the resolution to a width of about 768.

By the way, on the point that you can estimate memory performance from the results: for the S2, it reads 4 bytes × 15.4 × 1024x1024 in 40 ms, so it looks like it has more than 1.5 GB per second. For the iPhoneX, it's 4 bytes × 450 × 1024x1024, which is 45 GB/s. Is it really that big? Really? Maybe there's some trick to this too. For example, there may be some clever mechanism like compressing textures on their way from memory to the GPU, or maybe it's making good use of the cache. For example, if there were a mechanism that let the GPU also use the CPU's L2 cache, that would be megabytes of cache.
IncoherentTexture
This is CoherentTexture with a small tweak to the vertex shader.
o.uv = TRANSFORM_TEX(v.uv, _MainTex) * 16.0;
After calculating the uv, it multiplies by 16. That's all. The results then look like this.
| Machine | CoherentTexture | IncoherentTexture |
|---|---|---|
| i7-8700K,GeForceGTX 1080 | 4360 | 281 |
| MacBookPro13''(Chrome) | 54.6 | 14.0 |
| iPhoneX | 450 | 5.00 |
| XperiaXZ premium | 187 | 2.08 |
| AndroidOne S2 | 15.4 | 0.94 |
Compare them with CoherentTexture. "Brutal" is the only word for it.
This test measures texture read performance when the cache doesn't help. With CoherentTexture, painting the neighboring pixel just meant fetching the neighboring texel. So it was almost always in the cache, and not much memory access happened.
This time, however, the UV is multiplied by 16. The texel fetched when painting the neighboring pixel is a full 16 texels away. Memory reads still have a "unit", so it still brings over, say, a 4x4 area at a time. And then it moves on having used only one of them. The efficiency of memory access plummets. On the iPhoneX and XperiaXZ it falls to nearly 1/100.
Meanwhile, I don't know why the S2 only falls to about 1/16 and the MacBook Pro to about 1/4, but perhaps their "unit of memory read" is small. To take an extreme case, with memory that can be read 4 bytes at a time, no wasted transfer happens. The iPhoneX may raise its performance by fetching a whole lot at once, and that may have backfired here. Or it may be a problem of memory wait time (latency).
So, does this kind of performance drop happen in real situations?
It does. Downscaling.
If you shrink a picture to 1/2 and apply it, the texel fetched when painting the neighboring pixel is two pixels over. If memory is brought into the cache in 2x2 units, 3/4 of it goes down the drain. This situation arises if you prepare images for a 1920x1080 device and draw them on a 960x540 device. This test is equivalent to shrinking to 1/16, so if memory is fetched in 16x16 units, 255/256 goes down the drain. It's no surprise if performance drops to 1/100.
That's why mipmaps exist!
If you prepare the shrunken images in advance, you can properly use the neighboring texels. On smartphones, machine resolutions vary, so if you don't want to sacrifice performance, quality and power, you should prepare mipmaps. That said, they make the size at least 1.25 times bigger, so I understand very well why people agonize over it.
Incidentally, our Tokyo Prison doesn't use mipmaps. The idea is "if you shrink things, the fill area itself goes down and it gets lighter anyway, so no need to worry", but shrinking below half looks ugly, and lowering the resolution stops making things much faster. To hit the target FPS on the low-end machines, the only option is to design visuals that fundamentally have a small fill area, and as a result the picture you can show on high-end machines will probably change too. I'd add them if I could.
DependentTexture
First, please look at the fragment shader.
fixed4 frag (v2f i) : SV_Target
{
fixed4 c = tex2D(_MainTex, frac(i.uv + float2(0.5, 0.5)));
c.a = 0.5;
return c;
}
The only difference from CoherentTexture is that it adds 0.5 to the uv. The results look like this.
| Machine | CoherentTexture | DependentTexture |
|---|---|---|
| iPhoneX | 450 | 339 |
| AndroidOne S2 | 15.4 | 12.8 |
| XperiaXZ premium | 187 | 181 |
| iPad mini4 | 120 | 112 |
Just one extra addition, and yet some machines get slower by an amount you can't ignore: the iPhoneX and the S2. For the rest, it's hard to say whether they dropped.
Past PowerVR chips had a mechanism where "if the tex2D can be done before running the fragment shader, it is issued first, and execution starts once the data arrives from memory". If you calculated the uv in the shader, it would wait for the data to arrive after execution had started, and it got dramatically slower. At GDC 2012 there was a talk about the graphics of Infinity Blade, and in it, too, they said "do UV calculations in the vertex shader". The Adreno 308 in the S2, and whatever is inside the iPhoneX, may have something similar going on.
This test is for finding out whether a machine has that kind of weakness.
OpaqueColor
This is Color drawn opaque, that is, without alpha blending. The results look like this.
| Machine | Color | OpaqueColor |
|---|---|---|
| iPhoneX | 993 | 4100 |
| XperiaXZ premium | 429 | 430 |
| iPad mini4 | 148 | 655 |
| Nexus5 | 117 | 117 |
| AndroidOne S2 | 22.9 | 23.9 |
Some of them are inexplicably fast: the two iOS devices. Being four times faster just because there's no alpha blending is normally unthinkable. TBDR explains it.
When drawing opaque things, painting only the triangle that ends up being painted last gives the same result. If you knew in advance "which polygon will be painted last", you could skip the wasted fragment shader runs. Normally, though, you can't do that, because things are drawn in the order the vertices came from the CPU. So usually you use the trick of "drawing the nearest things first" so that as much as possible gets thrown away by the Z test. Unity also draws opaque things from front to back. But with TBDR hardware, you can reliably paint only the frontmost thing without doing any of this.
That said, the mechanism is quite involved. First it divides the screen into small rectangles of, say, 16x16, makes a list of the triangles drawn in each, finds the triangle that comes frontmost, and paints only that. In exchange for that extra work, for opaque things it only has to run the fragment shader once per pixel.
For semi-transparent things, all the fragment shaders have to be run, so most of the advantage disappears, but the advantages that alpha blending and Z testing are fast and that no memory is needed for the Z buffer remain. You only need memory for alpha blending and Z testing for the 16x16 area, and that small an amount can be provided inside the GPU, so there's no need to take it from main memory. It actually writes to the render target only after the tile has finished drawing, and doesn't access memory in between. There's a detailed explanation in the Infinity Blade material mentioned earlier, and also in PowerVR's official documentation. But these days you probably don't need to know it.
The reason almost all of these tests have alpha blending enabled is that I also want to measure the performance of TBDR machines. For example, even with a heavy shader like HeavyCalc, on a TBDR machine the shader runs only for the last draw, so at first glance it looks blazingly fast. So I have no choice but to make things semi-transparent.
So, this test is for finding out whether a machine is TBDR. Also, on non-TBDR models, it tells you the performance drop caused by alpha blending. For example, on the S2 the score goes up slightly. That difference can be taken as the load of alpha blending.
Closing
As you can see, even a rough, shabby-looking benchmark tells you a lot, and what it tells you reflects the characteristics of the hardware.
And the most important thing is that the range of smartphone performance is insanely wide. You have to think hard about who you're selling the game to. If your customers are "people who buy an iPhone every two years", you can use the latest techniques freely, but if you also want customers like "people who bought the cheapest one at Y!mobile and have used it for four years with a cracked screen", you have no choice but to target the bottom.
What's more, as smartphones mature, the performance of low-priced models has almost stopped growing. The S2 is a machine two generations after the 404KC from the same maker, but it hasn't gotten much faster. Low-priced machines probably won't get much faster from here on either. We need to think seriously about the fact that we have to deliver the same program to machines whose performance differs by 100 times. We have to find, as cheaply as possible, a way to run well enough on the low-end machines while giving reasonable satisfaction on the high-end ones. You could say these are pretty difficult times.
This benchmark is far from finished, and I'd like to add tests and improve it when I have time. For example, tests I'd like to add include:
- Measuring storage performance
- Whether performance drops with textures whose sizes aren't powers of two
- How many draw calls it can take
On draw calls, the quality of the OpenGL or Metal underneath Unity should make a big difference, and I'd like to check how big that difference is.
I'd also like to shorten the time it takes for the numbers to settle, and it might be nice to be able to post the results to twitter. Honestly, though, it's a pain, so I'd be glad if someone did it for me. The code is on GitHub.
By the way, who is this character?

The somewhat questionable character showing right after launch is named "Konchi". It's an original character of our company. There's a website, so if you have time to kill, take a look.
If you watch the first screen for a while, I think you'll see that the rendering is needlessly elaborate (it generates normals and roughness from the image any old way and does lighting calculations).
Actually, it isn't that "I decided to make a benchmark and then used Konchi"; the phrase "Konchi Bench" came to me first. Without Konchi, I don't think I would have made the benchmark at all.
Bonus
Here is the data I received after publishing.
CPU
| Machine | Browser | Released | FibonacciInt | FibonacciFloat | HeapSort | QuaternionIntegration |
|---|---|---|---|---|---|---|
| i7-3770 GeForceFTX960 | chrome | - | 0.065 | 0.078 | 0.881 | 0.389 |
| XBoxOneX | Edge | - | 0.141 | 0.198 | 4.77 | 1.42 |
| iMac2017 | chrome | 2017 | 0.051 | 0.059 | 1.13 | 0.422 |
| MacBookPro 15'' 2017 | chrome | - | 0.051 | 0.058 | 1.12 | 0.384 |
| iPhoneXS Max | chrome | - | 0.137 | 0.136 | 1.18 | 0.386 |
| Pixel3 XL | chrome | 2018 | 0.117 | 0.132 | 2.526 | 1.005 |
| XperiaXZ2Premium | chrome | - | 0.128 | 0.130 | 2.53 | 0.987 |
| OnePlus6 | chrome | - | 0.141 | 0.128 | 2.57 | 0.998 |
| Zenpad 3S 10 | chrome | - | 0.159 | 0.216 | 3.638 | 1.52 |
| XperiaXZ1 | chrome | - | 0.183 | 0.198 | 3.56 | 1.49 |
| iPhoneSE | safari | - | 0.188 | 0.187 | 2.51 | 0.643 |
| OculusGo | chrome | - | 0.208 | 0.281 | 6.275 | 1.77 |
| SC9853i | chrome | - | 0.575 | 0.624 | 10.7 | 3.11 |
| FTJ162E-RAIJIN | firefox | - | 0.328 | 0.420 | 8.46 | 6.79 |
| Huawei P20 lite | chrome | - | 0.528 | 0.555 | 7.751 | 3.839 |
| ElephoneA4pro | chrome | - | 0.467 | 0.501 | 8.52 | 3.46 |
| ElephoneA4pro | firefox | - | 0.790 | 0.446 | 7.49 | 5.09 |
| Priori4 | chrome | 2017 | 0.778 | 0.814 | 11.4 | 5.77 |
| HoloLens | Edge | - | 0.876 | 1.22 | 13.0 | 7.76 |
| FMV-BIBLO NF/C40 | chrome | 2008 | 0.162 | 0.209 | 2.96 | 0.993 |
| tpad P20HD | chrome | 2020 | 0.733 | 0.577 | 8.735 | 3.577 |
| Android One S6 | chrome | 2019/12 | 0.412 | 0.466 | 10.146 | 3.112 |
| ZenFone Max Pro (M1) | chrome | 2018/12 | 0.244 | 0.302 | 5.957 | 2.000 |
| Android One S3 | chrome | 2018/1 | 0.857 | 1.07 | 10.266 | 8.521 |
| ADP-503G | chrome | 2020/7 | 2.156 | 2.430 | 15.056 | 6.088 |
| RedMagic 10S Pro | Chrome | 2025 | 0.259 | 0.366 | 1.297 | 0.603 |
GPU
| Machine | GPU | Color | ColorZ | AlphaTestColor | HeavyCalc | CoherentTexture | IncoherentTexture | DependentTexture | OpaqueColor |
|---|---|---|---|---|---|---|---|---|---|
| i7-3770 GeForceFTX960 | GeForceGTX960 | 1450 | 1300 | 1610 | 402 | 1430 | 47.9 | 1430 | 1450 |
| XBoxOneX | - | 787 | 569 | 801 | 270 | 578 | 53 | 574 | 801 |
| iMac2017 | RadeonPro555 | 508 | 488 | 524 | 105 | 340 | 33.1 | 339 | 521 |
| MacBookPro 15'' 2017 | RadeonPro560 | 547 | 519 | 558 | 150 | 339 | 18.8 | 339 | 556 |
| iPhoneXS Max | AppleA12 | 1310 | 1270 | 928 | 58.5 | 559 | 11.0 | 432 | 5430 |
| Pixel3XL | Adreno630 | 417 | 425 | 288 | 37.9 | 258 | 5.02 | 227 | 418 |
| XperiaXZ2Premium | Adreno630 | 435 | 432 | 386 | 68.6 | 328 | 5.97 | 329 | 437 |
| OnePlus6 | Adreno630 | 431 | 431 | 386 | 61.0 | 327 | 5.97 | 326 | 436 |
| Zenpad 3S 10 | PowerVR GX6250 | 147 | 146 | 54.1 | 5.00 | 67.0 | 1.00 | 67.0 | 549 |
| XperiaXZ1 | Adreno540 | 430 | 421 | 369 | 32.0 | 179 | 2.01 | 189 | 432 |
| iPhoneSE | AppleA9 | 314 | 316 | 160 | 21.0 | 241 | 3.03 | 197 | 1600 |
| OculusGo | Adreno530 | 226 | 221 | 197 | 17.0 | 107 | 1.00 | 108 | 231 |
| SC9853i | Mali-T820 | 51.1 | 50.2 | 15.1 | 1.98 | 44.1 | 1.02 | 19.0 | 101 |
| FTJ162E-RAIJIN | Mali-T860 | 19.7 | 30.7 | 13.5 | 2.01 | 28.5 | 1.00 | 14.6 | 62.3 |
| Huawei P20 lite | Mali-T830 | 65.9 | 64.5 | 37.7 | 4.95 | 61.1 | 0.98 | 42.2 | 130 |
| ElephoneA4pro | Mali-G71 | 45.1 | 42.8 | 40.0 | 3.99 | 44.5 | 2.01 | 42.9 | 101 |
| ElephoneA4pro(firefox) | Mali-G71 | 19.4 | 19.4 | 16.3 | 2.00 | 18.9 | 1.00 | 18.7 | 43.2 |
| Priori4 | Mali-T720 | 6.24 | 1.35 | 3.00 | 0.94 | 3.02 | 0.97 | 3.00 | 8.01 |
| HoloLens | - | 26.1 | 19.3 | 28.1 | 1.26 | 16.6 | 0.47 | 15.4 | 29.1 |
| FMV-BIBLO NF/C40 | GMA 4500M | 9.42 | 7.48 | 9.32 | 0.64 | 7.34 | 0.36 | 7.15 | 10.03 |
| tpad P20HD | PowerVR GE8322 | 81.07 | 78.64 | 36.02 | 2.77 | 60.29 | 0.26 | 47.31 | 471.01 |
| Android One S6 | PowerVR GE8320 | 92.92 | 93.96 | 41.50 | 3.42 | 72.67 | 1.00 | 58.02 | 702.96 |
| ZenFone Max Pro (M1) | Adreno 512 | 126.51 | 122.64 | 48.62 | 4.87 | 78.75 | 1.17 | 75.14 | 126.53 |
| Android One S3 | Adreno 505 | 59.16 | 55.40 | 26.38 | 2.07 | 36.48 | 0.55 | 35.17 | 52.46 |
| ADP-503G | Malii-T720 | 18.33 | 17.62 | 5.64 | 0.56 | 15.92 | 0.34 | 7.26 | 18.66 |
| REDMAGIC 10S Pro | Adreno 830 | 1683.57 | 1628.2 | 1678.4 | 339.64 | 1645.95 | 36.68 | 1678.26 | 1681.28 |
What we can tell
- The iPhoneXS Max and iPhoneSE smell like TBDR. My impression is that Mali is simply slow at alpha blending.
- The Priori4 set a new record low! And it was released in 2017! With 2 GB of memory!
- Its website says "quad-core, runs smoothly", so there's a good chance buyers don't realize it's low-performance. And it has sold in fairly large numbers.
- It supports GLES3, so generation-wise it's new enough. How do you deal with "it doesn't fail to run, but it's slow"? I'd put this one among the test devices. Personally.
- The way the Mali-T820's DependentTexture drops bothers me.
- I thought GPU performance wouldn't change with the browser, but looking at the Elephone, performance drops on firefox, so maybe that can happen.
- The XBoxOneX's CPU is eight cheap cores, so its CPU scores come out low, but even so it's on par with high-end smartphones. And its GPU scores are high, as you'd expect. The high HeavyCalc score shows its raw computing power; compared on compute shader performance, it's far stronger than the likes of the iPhoneX. The results feel like a strong message to do your calculations on the GPU.
Interview with Hirayama, the author of this article
An interview with Hirayama, the author of this article, is published on the Kayac website. Please take a look!
A career theory of getting over walls by deliberately resetting your career so far | KAYAC
