Performance: in fairness

Discussion and feedback on Construct 2

Post » Tue May 23, 2017 8:09 am

Woah, that was a huge gap.

C2 in chrome on my iMac
Image

Unity WebGL on my iMac
Image

Pixi in chrome on mt iMac
Image


5000 vs almost 200.000 both are webGL, it's not even a fair comparison? What makes one so much faster than the other... that's what I would like to know. :P I know Asley always praise HTML5 and webGL for being almost native fast, and I believe him, but we're not there yet with C2. ;) But after all the C3 sales, maybe he can hire someone to optimize and bump those numbers up.

R0J0hound wrote:I think what's being measured from this is the speed of events or gdscript.

Maybe, but there seems to be something in C2 eating all the resources. Overhead, draw calls, who knows?
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Tue May 23, 2017 8:57 am

Image

Impressive, I actually reached over 100 000 bunnies before I got a slowdown and that slowdown was only during spawning so could probably mantain 60fps with a lot more bunnies.
B
52
S
22
G
12
Posts: 727
Reputation: 11,720

Post » Tue May 23, 2017 9:00 am

And now for the phone results. Nokia Lumia 830. Pixi does way better again.

C2
Image

UnityWebGL - Not even working on phone.
Image

Pixi
Image


I don't know what it is, but there's something Pixi is doing that seems to be superfast. about 10x-20x faster than all other webGL I've seen.

It's free and opensource, so I hope C2/C3 can take advantage of it in the future ;)

http://www.pixijs.com/faq
https://github.com/pixijs/pixi.js/blob/dev/README.md
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Tue May 23, 2017 11:04 am

You can't argue with Pixi's performance, simply amazing:
Image

Would be very interested if C3 can take advantage of whatever magic is allowing this
B
57
S
19
G
9
Posts: 639
Reputation: 9,533

Post » Tue May 23, 2017 11:19 am

Wtf
Image

I gotta say pixi.js blew me away. The few long drops are when I change tabs (it seems to idle at 30fps), but when it's not creating bunnies, it runs at more than 50FPS and it's pretty stable.
Image
B
34
S
6
G
2
Posts: 221
Reputation: 3,324

Post » Tue May 23, 2017 11:26 am

AFAIK C2 has a similar WebGL batching engine to Pixi. I think the main performance difference when you get in to the tens of thousands is just hand-written dedicated JavaScript vs. the event engine overhead. C2's engine also does a lot more work: for example it makes the assumption you will be using collisions so it shares the rendering vertex data with the collision engine so it doesn't have to be re-computed, but this adds a bit of extra overhead. So we could probably make some similar optimisations if we entirely removed the collision engine, but then it's not a very useful game engine any more!

Benchmarks are only useful to a point - I mean if you can hit 5000 moving on-screen sprites at 60 FPS, how many games are going to need more than that? A good way to think about the overhead is the per-sprite time. 20000 sprites @ 60 FPS means it can render 1.2 million sprites per second, or about 833 nanoseconds per sprite. If that's improved to 30000 sprites @ 60 FPS, it means the overhead per sprite has reduced to 555 ns, saving about 278 ns per sprite. This is very much microbenchmarking, and improvements like this can take a long time, and yet bring no meaningful performance improvement to real-world games.
Scirra Founder
B
387
S
230
G
88
Posts: 24,251
Reputation: 192,454

Post » Tue May 23, 2017 11:34 am

Elliott wrote:You can't argue with Pixi's performance, simply amazing:
Image

Would be very interested if C3 can take advantage of whatever magic is allowing this


Yeah, If C2/C3 could implement whatever voodoo, witchdoctor, hocus pocus they are using for Html5/webGL performance, Construct would slap all other 2D engine competition on the fingers big time. :p

Right now Construct is pretty much on par with most html5/webGL solutions i've seen out there I think, but pixi.....is just ..... mindblowing. :o

Ashley wrote:I mean if you can hit 5000 moving on-screen sprites at 60 FPS, how many games are going to need more than that?


It's ok on desktop, but html5 for those of us who develop for mobile.... we need some of this kind of optimizations. I think Ashley is assuming that everyone doing mobile games want to do flappy bird clones with max 100 sprites on screen for decent performance.

This is pretty much what a midrange phone can handle.
Image
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Tue May 23, 2017 2:29 pm

Mobile test:
-PixiJS: 3800 bunnies at 29 - 30fps on Chrome browser LG G4 (6000 at 26fps)

-C2: 630 bunnies at 26 - 32fps on same device as above

-Unity WebGL: does load after warning, does not scale to fit, does not recognize touch, 11fps in portrait with starting bunny count

PixiJS Bunnymark desktop:

Firefox 76200 bunnies at 50fps
Chrome 75400 bunnies at 44fps

Allowing Unity native to hit as low as 30fps I get 28761 bunnies, so it seems PixiJS has some great optimizations either in sprite batching or in the code behind it (I haven't tried optimizing the Unity version at all from the OP's git account)
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit
B
113
S
39
G
17
Posts: 2,184
Reputation: 19,217

Post » Wed May 24, 2017 2:07 pm

If you test C2 please make sure you replace the "For each" condition with "Every tick", otherwise it's needlessly inefficient. The github hosting the examples still has the unnecessarily slow "for each" version.

So I looked in to Pixi's code to see how they're rendering those bunnies, and it turns out they use a similar rendering technique to the particles object. So I made a similar test in C2 using the Particles object instead, and you can get similar performance gains.

Testing on a HTC 10:
Sprites: https://www.scirra.com/labs/c2bunnymark/ - ~5500 @ 30 FPS
Particles: https://www.scirra.com/labs/c2bunnyparticles/ ~31000 @ 30 FPS

Particles are super fast, over 5x faster at rendering! It's magic! Well, not really - particles are a really limited case so we made special optimisations to render them faster, much as Pixi's bunnymark does. They're too limited to work for general purpose sprites. Also like bunnymark, particles don't process collisions at all, so that overhead is removed. So this idea that we can magically make everything faster by rendering sprites like particles isn't really feasible.
Scirra Founder
B
387
S
230
G
88
Posts: 24,251
Reputation: 192,454

Post » Wed May 24, 2017 2:53 pm

@Ashley Yeah it looks a bit better now. I got 740 bunnies @ 30fps on the same phone, with the old C2 test i got 300 @ 30fps. Although I could wish for a bit more as Pixi's bunnymark was close at 8000 bunnies @ 30fps. Although my phone is quite weak. 2 year old midrange phone. (Nokia Lumia 830)

Would be curious to see if there's any difference in C3 vs C2.

C2 bunnymark - Updated. 740 bunnies @ 30fps
C2 bunnyparticles - 2000 bunnies @ 30fps
Pixi Bunnymark - 8000 bunnies @ 30fps (I know pixi is cheating a bit by rendering at windowsize/2) If you look closely it's pixellated. not 1:1 pixel density.

Setting the render scale in runtime for lower/midrange phones would be nice, and maybe some other tweaks, so we don't have to design the game for low and phones, and scale up, for powerful phones. Some mobile specific tweaks would be nice. Maybe a windowsize/2 option would be good for mobiles, as they have really high pixel density, and you don't really see it.

I'm currently recreating my game and all assets optimized for 640-360, upscaling to 1280x720, to save some memory and a bit performance boost for low-mid range phones.

I hope you will get some time at a later point to investigate some further improvements to get a bit closer to the pixi score. (Maybe just mobile specific tweaks) I think it's quite important for us doing mobile games, as we could lose a whole segment of users, and bad reviews if we can't get good enough performance on midrange phones. Keep it up!
Last edited by tunepunk on Wed May 24, 2017 3:02 pm, edited 1 time in total.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: wmnjunior and 3 guests