lots of bugs / warnings c2runtime

Discussion and feedback on Construct 2

Post » Tue Apr 12, 2016 9:50 pm

hey everybody..

@Ashley - i have a question (or few), i've exported html 5 pure empty project with nothing in it, nonminified, and i've noticed after running it in visual studio and some web analyzer that a lot of bugs suddenly appears (as you can see on image).
http://i.imgur.com/vsHNsFp.jpg

now i've ran through these warnings and stuff and i've noticed that some are really "heavier" bugs that might cause some overheads when compiling / running because they create exception objects and traverse upwards until they find a catch statement to be thrown or caught. so this might be a problem maybe that is flooding c2 currently.

i've also attached a c2runtime.js that is cleaned of these bugs, you can use araxis merge / kdiff and compare it to normal exported empty project c2runtime.js to see the changes and tell me what you think? could you insert those fixes for next release? (they might not improve performance and all, but they might create more stability though)

https://www.dropbox.com/s/124wyh4f20f4p ... me.js?dl=1


p.s. if you wonder how i found those bugs - download visual studio 2015 community, install everything (cordova tools and all), export empty project, open visual studio, create blank apache cordova app, copy c2runtime.js to www/scripts folder, open tools, extensions and updates, find Web Analyzer tool, install, restart VS, and open again the same project and opet c2runtime.js in visual studio, after a few sec it will show you errors like on picture above.
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 » Wed Apr 13, 2016 6:35 pm

another thing to notice (for semicolons) .
http://www.bradoncode.com/blog/2015/08/ ... insertion/

it would seem that a lot of things are processed if there is a missing semicolon, valid tokens get immidiately to read the next one, but the ones missing seem to do a bit of overhead. (check image "putting it all together")
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 » Thu Apr 14, 2016 9:01 pm

hey

@Ashley - i've cleaned all the behaviours with Web Analyzer and will leave clean versions on my dropbox, download file is here:

https://dl.dropboxusercontent.com/u/136 ... thLint.rar


i've also replaced them in html/exporters, ran a project and everything seems to be smooth, no errors, no bugs, seems to be okay.
i'll go clean plugins next. and then the JS files in html5/exporters
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 » Fri Apr 15, 2016 10:28 am

I don't think any of those messages matter at all. They are just coding style messages. We use our own tools for that.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Post » Fri Apr 15, 2016 11:06 am

mostly i agree, but compilers / interpreters have to handle javascript errors when they are caught and losing time to handling them just to avoid errors takes some small amount of time. when it gets loaded with such small time errors - all together it causes a bit more of time wasted.

nontheless i'll do my job and clean the rest of the files on the current version of C2 and upload them here. you can still check them and use if you want, if you don't want won't bother me, i'm just trying to help you out guys :)

anyway this analyzer does the following: CoffeeLint, ESLint, CSSLint, TSLint.
more details here: https://visualstudiogallery.msdn.micros ... 820d79be1d
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 » Sun Apr 17, 2016 12:15 pm

here, i've cleaned the plugins with JSLint (runtime and editme). tested on 3-4 projects and my huge one, everything seems to work normally, didn't have errors before, don't have them now, still might help with minimizing / compiling errors.
@Ashley
https://dl.dropboxusercontent.com/u/136 ... lugins.rar

i'll go and finish with JS files in c2/exporters/html
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 » Sun Apr 17, 2016 12:54 pm

saiyadjin wrote:mostly i agree, but compilers / interpreters have to handle javascript errors when they are caught and losing time to handling them just to avoid errors takes some small amount of time. when it gets loaded with such small time errors - all together it causes a bit more of time wasted.

I'd have thought this would make almost no difference at all. They are not errors, it's just coding tips provided by a style tool, and whether they are corrected or not it's still standards-compliant Javascript code. Can you actually measure an improvement after the changes?
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Post » Sun Apr 17, 2016 2:39 pm

maybe, not sure that there is a performance improvement, but following these fixes that JSLint provides makes code more "stable" and less prone to errors. also minification works better when it's clean.

i was checking code for performance improvements and i'll do that next once i finish this "cleanup". i've spotted some functions and stuff that can be improved, possibly only in microbenchmarks, but lots of micro ~ 1 macro :)

i noticed that some statements don't end with ";" for example, which makes compiler compile 2 times the same statement because JS compilers "try" to parse the same thing with / without ";", so if it's missing it's doing a double job. (at least according to guys on stack overflow). still some functions that are long one liners (saw these a lot) and end up with })})})}) are better written }); }); }); just because it provides more stability when compiling and reducing errors.
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 » Mon Apr 18, 2016 12:09 pm

Unless you can actually provide benchmarks that indicate a measurable difference, this is basically a waste of time. I don't see any real measurements proving there is an improvement, and I don't believe there is any technical reason for there to be any improvement either. Minification radically alters the code so much that the original formatting doesn't matter much, coding styles don't usually affect functionality, and I don't know what you mean by "compiling stability" or "reducing errors", the current code is still standards-compliant Javascript so will be parsed, compiled and executed more or less identically regardless of whether there are extra/missing semicolons, parentheses, etc.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Post » Mon Apr 18, 2016 12:43 pm

i don't see why following conventions that were written by JSLint and other JS developers shouldn't be followed. even a small semicolon missing can cause errors in execution of code, same as badly written code. i've just used the tool to fix the few missing errors in each JS file you provide.
if you really don't trust me, just check how much "fight" did they have about one single semicolon on bootstrap, and in the end both jQuery and bootstrap fix'd the error - https://github.com/twbs/bootstrap/issues/3057

also like i said, i'll post (today or tommorow) cleaned the rest of files, and then i will go do some microoptimizations (maybe i find even some larger ones, we'll see), just don't come then saying "but this small optimization doesn't mean much, so we won't implement it", because in tight performing systems like game engines, each optimization is a bless.
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

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests