Mailing List
Home
Forum Home
Flash Pro
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Variable Optimization by the Flash Compiler

Variable Optimization by the Flash Compiler

2004-03-01       - By Jesse Warden

 Back
Reply:     1     2     3     4     5     6  

I think Darron is recovering from jet lag or Andreas is just taking awhile
to write his answer.

*ahem*

>From what I know from reading Flashcoders a long time ago is that small
varible names lead to small string names.  Since, bytecode wise, they are
just one big hash table using strings as keys (I think).  Therefore, it's a
longer to search for variables that have longer names.  That is the key to
the speed decrease.

This is exponential using dot syntax with movie clip paths.

Like:

_root.cow.moo.foo.bar

If you look in the decompiled bytecode via Flasm, the amount of bytecode
used for dot syntax vs. slash "/cow/moo/foo/bar" is a few lines smaller.
Couple that by how many thousands of places in your code, and this adds up
in filesize and speed.

Specially in:

this.mc._x += 8;

vs.

setVariable("/mc", "x", getVariable("/mc", "x") + 8);

That alone is enough to make or break a lot of games people make in Flash.
Regardless of what the documentation says, setVariable/getVariable as well
as tellTarget are NOT depreciated.  Course, after doing that, you still
gotta go in the bytecode and make more optimizations, but I'm not that much
of a geek.




-- --Original Message-- --
From: Justin Palmer [mailto:justin@(protected)]
Sent: Monday, March 01, 2004 05:04 PM
To: flashnewbie@(protected)
Subject: [Flashnewbie] Variable Optimization by the Flash Compiler


Hi,

I have heard many times to watch your variables lengths in your movies to
help execute code faster and to make smaller movies.  Is this true? If so,
why?

I look at the Java Virtual Machine, and say why would it be so hard for the
flash compiler to do the same.  The JVM takes all of the variable names and
reduces them to a minimal name for you.  This great so that Programmers can
program with variable names that make sense for the situation with out
worrying about what the compiler does with them and how it could effect your
movie.  There in increasing maintainability and readability for all
programmers on any given project.  Any insight would be great.

Regards,

Justin Palmer
__ ____ ____ ____ ____ ____ ____ __
Council for Educational Travel, USA
1403 View Avenue
Centralia, WA 98531
USA
T: 1.360.736.6472
F: 1.360.736.6525
E: justin@(protected) <mailto:justin@(protected)>
W: http://www.cetusa.org
Other:
http://www.cetmanagement.com
http://www.dfsr.org

Mission Statement:  "Reaching out to encourage a lifelong journey of global
peace and understanding"




-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Supported by Fig Leaf Software
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Lower Prices for Certified Training! Check out new lower prices for
Certified Macromedia Training from Fig Leaf Software. Expand your skill set
with courses in ColdFusion, Flash, Rich Internet Applications and .NET in
the new year.  Fig Leaf Software provides
the highest caliber instruction at our training centers in Washington  
D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your
location.

Get the details at http://training.figleaf.com/
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected)
For additional commands, e-mail: flashnewbie-help@(protected)


-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Supported by Fig Leaf Software
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
Lower Prices for Certified Training! Check out new lower prices for
Certified Macromedia Training from Fig Leaf Software. Expand your
skill set with courses in ColdFusion, Flash, Rich Internet
Applications and .NET in the new year.  Fig Leaf Software provides
the highest caliber instruction at our training centers in Washington  
D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at
your location.

Get the details at http://training.figleaf.com/
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected)
For additional commands, e-mail: flashnewbie-help@(protected)