Vanilla js and it's impact to performance

Discussion and feedback on Construct 2

Post » Tue Apr 28, 2015 10:29 am

i've noticed that jQuery is being used by construct and i've read that its performance it not so huge, it's okay for web sites, but i think it slows down games.

also i've seen some performance comparisons here:
http://vanilla-js.com/

where you can see massive difference in OPS/s between vanilla JS and jquery.
what i'm mostly concerned about is getting DOM elements - if they're handled every tick for drawing/redrawing/etc., using vanilla would improve performance pretty
much, don't you think @Ashley?

anyone?
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,450

Post » Tue Apr 28, 2015 1:06 pm

I do not pay attention to any discussion of performance unless the discussion includes measurements. I have rarely measured any detectable performance impact from jQuery in our engine, and it is used very little.
Scirra Founder
B
398
S
236
G
88
Posts: 24,442
Reputation: 194,683

Post » Tue Apr 28, 2015 1:20 pm

There are some performance measurements on that site (ops/sec)... dunno how much objectivity it is, "Never ask a barber if you need a haircut." :P
However I've profiled sometimes the C2 js and jQuery isn't the problem ;)
Luca ConTato [RisingPixel]
Image
B
22
S
8
G
2
Posts: 113
Reputation: 2,901

Post » Tue Apr 28, 2015 2:02 pm

Having been in the run time of C2. jQuery is barely used and isn't used per tick.

However as a general rule of game design in C2. Don't use DOM on a per tick basis. If you use DOM leave it special Layouts where information processing is the aspect done. Don't use DOM to display text in an action game, don't use DOM.

Dom
TextArea
TextBox
anything with text that isn't SpriteFont
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Tue Apr 28, 2015 3:33 pm

i think there's a lot of jquery vs javascript jsperf examples that show pure javascripts speed over 10-1000 times faster depending on the use case.

anyway my point was that c2runtime could be optimized even more (i've found a couple examples and i intend to post a list of changes with all data / old vs new testing, code, 10 runs, average etc..)

i know that mostly problems for people who export are in crosswalk and xdk, but i'm pretty sure there's much to be done here too.

@jayderyu - thnx :)

also i didn't check how much jquery does c2 use, but i thought it was a small amount since i didn't find much of it anyway.
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,450


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests