In AS3, you should declare a non-dynamic class for your data items
rather than using untyped Objects. For example, don't use data items
like
{ foo: 100, bar: 200 }
Instead write
new DataItem(100, 200)
where
class DataItem
{
function DataItem(foo:int, bar:int)
{
this.foo = foo;
this.bar = bar;
}
var foo;
var bar;
}
A non-dynamic class like DataItem takes a lot less memory and you can
access foo and bar faster on it.
A plain Object is basically a name/value dictionary where AS3 has to do
a name lookup in a hash table.
By contrast, a non-dynamic class is laid out compactly in memory so that
AS3 knows that foo is at offset 4 from the beginning of the data item in
memory, bar is at offset 8, etc. It can then read and write them quickly
without any lookup.
When you use a non-dynamic class, each int, uint, Boolean, and object or
string reference will take up 4 bytes, while each Number will take up 8
bytes. Each instace also has a 16-byte header for keeping track of what
class it belongs to, etc. There is also some rounding up because the
memory manager allocates only chunks of certain sizes.
- Gordon
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of JesterXL
Sent: Friday, January 20, 2006 5:34 PM
To: [email protected]
Subject: Re: [flexcoders] Performance question - please help!
Sure; Flex 2 gets all of Flash 8's bitmap features with the added
benefit of
a fast as nuts AVM. As far as the data, though, not sure. I've spent 3
years pushing Flash to it's limits and know where she breaks, but
garbage
collection & tons of data, I haven't really found the ceiling yet in
8.5.
What I have found is "fixed in the next build", so it all sounds
promising.
Flash in general has problems creating millions of objects because of
the
overhead associated with the actual creation of "Object" in Flash.
There is
a lot of overhead, and while it's significant for the hundreds, for the
thousands & hundreds of thousands, those bytes start to add up. This is
significantly improved in 8.5. No, I don't have details; basically, the
amount of overhead is significantly reduced; it was a big problem in
Flash
hitting the "hundreds of MovieClips" limit, and now works great... well,
as
best an alpha can be. Besides, the way it was explained no sense...
something about byte headers, and trait objects, and all kinds of other
low-level insanity you have to be a genious to understand... or a Comp
Sci
grad I reckon.
Max memory? Nope; I've had Flash take up to 2 gigs once, it was
awesome!
Again, haven't really pushed 8.5 yet since she isn't done.
As far as porting, yeah, I agree. We've used a Flash 8 loaded SWF in 2
projects to enable file-upload, and while it works for the most part,
it's
not eloquent, and not being eloquent ticks developers off.
Actually, 720,000 doesnt' sound to bad... what properties do these data
points have? Like an ID and Name, or a long list or what?
As far as GC, hell no; if Adobe published how their GC worked, and
changed
it, we'd all be f00ked. I think Tinic's article is the only one that
has
lasted:
http://www.kaourantin.net/2005/09/garbage-collection-in-flash-player-8.h
tml
There was a comment on another article where he described how using 1
member
variable vs. many locals was better... even though locals were optimized
for
local registers in Flash Player 7 making functions faster... it's all
confusing.
There was an in depth article that disappeared from the face of Google;
I
haven't seen it in 2 years, but don't know if it was worth reading or
not.
Anyway, let us know about the data points; what their properties are, I
can
run some tests when I'm done with this project.
----- Original Message -----
From: "Jonathan Hirschi" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, January 20, 2006 5:46 PM
Subject: Re: [flexcoders] Performance question - please help!
So in terms of Flex 2, would it be able to possibly
handle this amount of data effectively since it uses
flash 8?
It sounds like you are saying that 1.5 has trouble
displaying that amount of data because of ram usage
problems? does that same problem exist in flex 2?
Is there a max on how much memory flash player 7 is
able to use effectivly? is that max much larger in
flash 8.5 player?
It sounds to me like it might be easier to port this
thing to flex 2 than it would be to try and plug in to
flash 8 bitmap features and draw my own graphs.
as far as data points, well, it's 200 machines * 60
properties * 60 minutes = 720,000 data points that i
need to hold in memory at any given time. I'm also
being asked to update the data points at a rate of
once per minute ie 200 machines * 60 properties =
12,000 updated data points per minute with an eventual
goal to get those updates down to once every 10
seconds..
is that something that is doable by flex 2 even?
They've got an app here written in mfc (c++) that can
do it, but they'd like to have it accessible from
anywhere on the web...
Have there been any performance papers published on
flash describing memory usage, etc?
Thanks!
--- JesterXL <[EMAIL PROTECTED]> wrote:
> Answering from the 30,000ft view, my suggestion is
> to utilize Flex 1.5 &
> Flash 8's bitmap features. Flash Player 7, which is
> what Flex 1.5 outputs,
> cannot handle the amount of data points you want
> with acceptable
> performance, either in code or displayed. While
> paging can be effectively
> employed, you'd probably lose the visual
> representation you are going for.
>
> Therefore, utilizing the bitmap imaging code Flash 8
> exposes, you could
> incoporate a component into Flex that utilizes
> blitting of those data points
> to 1 bitmap. The upshot us, it can scale infinitely
> since it's 1 bitmap,
> and an acceptable, predicatable RAM usage. The
> downside is, you still
> wouldn't really be able to retain the data if it's
> in the 100,000 range, but
> if it's just 60 pointers to machines, that's cake.
>
> ----- Original Message -----
> From: "Jonathan Hirschi" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Friday, January 20, 2006 4:10 PM
> Subject: [flexcoders] Performance question - please
> help!
>
>
>
> Ok, so here's the situation, i've been tasked to
> write
> an application that shows a ton of graphs (testing
> the
> performance of flex).
>
> i need to create like 60 objects that will be
> holding
> approximately 100,000 datapoints apiece
> and i need to create those objects dynamically...
>
> is it going to be better/ more efficeient to create
> the objects as a class? or does it matter?
>
> if i create the objects as simple objects within the
> parent document is that going to have any effect on
> performance?
>
> ie what i have going on is that i have to show like
> 60
> graphs - one per Property (like envision the graphs
> they show on the perfmon)
> so each property would be like hits per second, etc
> and i need to show up to 200 machines in each of
> those graphs...
> each machine represents 1 series in the graph and
> has
> 60 datapoints and i need to create the objects to
> hold
> that dynamically.
> ie each chart would be 1 object
> each chart would have x number of machines in it
> ie a structure of arrays of structures :)
>
> anyway, do you know what's going to give the best
> performance...?
> and/or how to create new public objects
> dynamically?'
> is it just public var ["blah"+i] = new object()?
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
>
> --
> Flexcoders Mailing List
> FAQ:
>
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
>
http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/