FORUMS

Which Lockscreen Security Type Do You Use?

From pattern locks to the controversial face unlock, there are a number of different ways you … more

Xposed 3.0 Alpha 3 Released

A new alpha for the Xposed framework is out and brings several bug fixes. You’ll only need to flash … more

XDA Recap: This Week In Android (Apr 18 – 25)

Here in the digital XDA newsroom, we spend our days pouring over an average of … more

Sunday Debate: Custom ROMs vs. Modular Tweaks

Join us in a fun Sunday Debate on Mods and ROMs. Come with your opinions and feel free to … more
Post Reply Subscribe to Thread Email Thread

Global variable make app or game slow ?

Yesterday, 03:34 PM |#11  
Member
Thanks Meter: 17
 
More
No but if you're using a lot of globals it tends to mean that you're not thinking in an optimal manner for JavaScript coding. Same when people rely on eval(). You need to think less about globals and more about objects, properties, and scopes. JavaScript is fundamentally object oriented, everything is an object... and most objects can contain every other kind of object... do instead of a global called myDataUrl, you could append a .data_url property to the object you created with that data. This way, each such object has that property, you don't have a tonne of globals to manage, and you can access the urls systematically. Generally speaking, a high number of globals signals that you don't understand JavaScript fundamentals and so you're likely doing things in a suboptimal way. THAT could result in slower code that's also hard to maintain code.

Sent from my SM-N910W8 using XDA Free mobile app
 
 
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes