PDA

View Full Version : MX: Heavy XML & MC Duplication ... slowdown?!



CEOofAEP
September 26th, 2005, 10:23 AM
It's about time I use a Questionmark AND an Exclamation point :D

Okay- I made an FLA / SWF file that goes through 5 (or actually 7) XML files (Team Statistics, Current Standings, Game Commentary, Conference, etc) for a Soccergame Application for a German Sports Agency.

This is the application in question:
http://www.sportal.de/tracker/tracker.html

It starts off in the conference mode- to see the actual problem I'm having with it, click on one of the games in the games list at the top (next to the rotating Ball-animation AVI)...

All the Players on the Field on the right are instances of a single MC, so are all the ball symbols, penalty card symbols, etc. The way the players are displayed on the filed is a dynamic function that checks for many players are playing in which position (offence, midfield, defence)... and the whole application refreshes about once a minute.

The problem is, it slows down to an almost complete stop in this mode and I have no hint or trace of why that might be... I used to use duplicated movieclips with "onEnterFrame" as wait dummies but I switched most of that to using "setInterval"...

I also skip alot of the "re-initialization upon reload" by now and really only reload the stuff that is subject to change but still it gets really really slow.

I know it's kind of a shot at the blue to ask you people what you think might be the reason for the slowdown without being able to show you the sourcecode... but maybe one of you can tell me off the top of their head what a common mistake might be for working with XML and duplicated MCs?

I heard / read that there's a way to unload the XML- but since it's always the same XML files handled by the same XML handlers, that shouldn't take up more space over time, should it?

To me it seems as though the slowdown is a Cache Overflow... the memory being slowly filled to the rim... but I can't imagine what might be the cause.

I feel incompetent :-/

ntshp
September 26th, 2005, 10:36 AM
If you have a large amount of XML data being read in it can slow down, it's simply not as fast as say php/mysql.
Switching to using a database would be a pain on the coding side but as the project grows xml just wont be fast enough.

My 2cents could be wrong :sigh:

CEOofAEP
September 26th, 2005, 10:58 AM
I appreciate any :2c: I can get... thing is that the XML coming in is live files being "outputted" by the sport scouts that type it out live and then publish it to the server (from where it also is exported to other formats)... I am convinced the data already exists as mySQL somewhere, from the application the scouters use- but for some reason, XML is what I am supposed to use.
It might be an explanation that it's the XML... because there's alot more XML processed in the "single game view" screen than in the conference... but then again, there's also more MCs in the single game view. I guess it's just a combination of everything.
It just strikes me as strange that it successively gets slower, instead of being slow to begin with... which is why I'm thinking it might be something "unclean" in the code but I programmed it to the best of my knowledge :-/

ntshp
September 26th, 2005, 11:16 AM
Oh got ya, so XML is all you have to work with

Pureley guesses without seeing the code, but from what you said it could be that the setInterval is calling your function and while processing the data runs out of time and then the next step is called. Leaving a redendunt function trying to keep up
Perhaps increase the interval?
(didnt notice the 2c emote)

CEOofAEP
September 26th, 2005, 11:52 AM
yea... it goes *really* slow when I had the interval at something around 40 seconds for testing in the beginning... of course, setting the Interval to a longer step will cut down on the reload cycles in general (as another positive side-effect, besides giving the functions more time to finish)... but I don't think that soccer fans will like it too much if they have to wait longer than 2 minutes for the refresh of the live commentary :-/

CEOofAEP
October 11th, 2005, 10:26 AM
Behold the solution to my problem :D

The main file of the Match Centre was apparently the cause for most of the slowdown / cluttering / clustering. During the process of refining my code while troubleshooting and debugging, I simply changed the function that is tied to the "onLoad" of the XML, like so:function XML_reload_function(loaded) {
if (loaded) {
var reload_trigger = false;
if ((_root.this_filesize == undefined) || (_root.this_filesize != this.getBytesTotal())) {
reload_trigger = true;
}
if (reload_trigger) {
_root.this_filesize = this.getBytesTotal();
// -> Regular previous code here. <-
}
}
};Now it works like a charm because it really only reloads if the data has actually changed during the last reload interval (by checking and setting the new and old filesize of the XML file in question)- and not automatically.

Maybe this helps someone out there with similar problems. :)