spliceで軽量化
200コぐらいのインスタンスをfor文で attachMovie してぐりぐりしてたら、そのうち動作が重くなる。これは予想していたので、ステージをはみ出たオブジェクトを removeMovieClip 。これでなんとかしのいできた。
attachMovieしたインスタンスのプロパティは配列に入れてそれぞれあれこれしてたから、この配列リテラルも消しちゃったほうがいいはず。
var obs:Array = new Array();
for (var i:Number = 0; i < count; i++) {
var obj = attachMovie("obj" , "obj"+i , i);
obj._x = Math.random() * Stage.width;
obj._y = Math.random() * Stage.height;
obj.hoo = hoo;
obj.bar = bar;
.....
obs.push(obj);
}
obj.removeMovieClip();
obs.splice(i,1);
こんな感じでいらなくなったものはspliceしていく。配列からspliceすることで動作に影響があるのどうか実験してみたけど、動作が重くなる主原因はどう考えても描画系にありそうなのはまいちがいない。
でもメモリやCPUの負担は減るはずだし、多次元配列なんか使っていたらもっとクライアントマシンにやさしくなるんじゃないかな。
という訳で要らなくなった配列インデックスは面倒がらずにspliceしましょう。
コメント
I love your blog.. very nice colors & theme. Did you create this website yourself? Plz reply back as I’m looking to create my own blog and would like to know wheere u got this from. thanks
投稿者: madhan | 2011年07月23日 17:22
There are certainly a number of details like that to take into consideration. That could be a great point to convey up. I provide the thoughts above as common inspiration however clearly there are questions like the one you convey up where a very powerful thing might be working in honest good faith. I don?t know if finest practices have emerged round issues like that, but I'm certain that your job is clearly identified as a good game. Both boys and girls feel the affect of just a second’s pleasure, for the rest of their lives.
投稿者: Angie Varona | 2011年07月24日 01:03
The turn around look ahead system is fast and straightforward while use, enter the number you want with the aim of turn around look up and about plus the results are displayed instantaneous. What's displayed is partial essentials as regards the mobile phone number. With the aim of receive the entire facts a small charge is required.
投稿者: cell phone number lookup | 2011年07月24日 04:01
Using employing invalidate cellular phone number lookup services it truly is particular probable after locate who may possess been calling you actually.
投稿者: 3 Red Lights On Xbox 360 | 2011年07月24日 05:20
I definitely wanted to develop a small remark to be able to appreciate you for the remarkable techniques you are placing on this site. My time-consuming internet search has now been rewarded with sensible tips to talk about with my relatives. I 'd tell you that many of us readers are unquestionably fortunate to dwell in a remarkable site with very many marvellous individuals with insightful plans. I feel extremely grateful to have seen the webpages and look forward to some more entertaining times reading here. Thanks again for all the details.
投稿者: school grants | 2011年07月24日 08:29
This web page is known as a walk-by way of for all of the info you wanted about this and didn’t know who to ask. Glimpse here, and also you’ll definitely uncover it.
投稿者: Bitcoin | 2011年07月24日 09:11
It’s rare for me to find something on the web that’s as entertaining and intriguing as what you have got here. Your page is sweet, your graphics are great, and what’s more, you use source that are relevant to what you’re saying. You are certainly one in a million, well done!
投稿者: Mishaw | 2011年07月24日 13:17
I discovered your weblog site on google and examine a few of your early posts. Continue to maintain up the superb operate. I just extra up your RSS feed to my MSN Information Reader. Looking for forward to reading more from you later on!…
投稿者: Attention Deficit Disorder Symptoms | 2011年07月24日 20:27
I discovered your weblog website on google and test a number of of your early posts. Proceed to keep up the excellent operate. I just further up your RSS feed to my MSN Information Reader. Seeking forward to reading more from you afterward!…
投稿者: Braun Oral B | 2011年07月25日 01:36
Hello There. I found your blog using msn. This is a very well written article. I’ll make sure to bookmark it and come back to read more of your useful information. Thanks for the post. I will definitely comeback.
投稿者: Dan johns | 2011年07月28日 19:24
This is really interesting, You're a very skilled blogger. I have joined your rss feed and look forward to more of your great post. Also, I've shared your website in my social networks!
投稿者: Ron dawe | 2011年07月28日 20:11
Hello There. I found your blog using msn. This is an extremely well written article. I will make sure to bookmark it and come back to read more of your useful information. Thanks for the post. I will certainly comeback.
投稿者: matthew bird | 2011年07月28日 20:34
I’d must examine with you here. Which isn't something I usually do! I get pleasure from studying a submit that can make folks think. Also, thanks for allowing me to remark!
投稿者: american express rewards | 2011年07月29日 00:15
I’d need to verify with you here. Which is not one thing I usually do! I take pleasure in studying a put up that will make people think. Additionally, thanks for allowing me to remark!
投稿者: labido | 2011年07月30日 04:55
I found your blog website on google and verify a couple of of your early posts. Proceed to maintain up the very good operate. I just additional up your RSS feed to my MSN News Reader. Seeking ahead to reading more from you afterward!…
投稿者: Buy polo shirts online | 2011年07月31日 00:48
It’s laborious to search out educated people on this topic, but you sound like you recognize what you’re talking about! Thanks
投稿者: bulk sms marketing | 2011年08月01日 08:27
You are too going with the intention of necessitate with the intention of accomplish persuaded at what time the service provider has an extensive list of numbers so down load as several numbers with the intention of check since home seeing as possible.
投稿者: phone number look up | 2011年08月03日 10:25
hello there and thank you for your information – I’ve definitely picked up anything new from right here. I did however expertise some technical issues using this site, as I experienced to reload the site a lot of times previous to I could get it to load correctly. I had been wondering if your hosting is OK? Not that I am complaining, but slow loading instances times will sometimes affect your placement in google and could damage your high-quality score if ads and marketing with Adwords. Anyway I’m adding this RSS to my e-mail and could look out for much more of your respective fascinating content. Make sure you update this again very soon..
投稿者: izle | 2011年08月03日 15:21
I admit, I have not been on this webpage in a long time… however it was another pleasure to see It is such an essential topic and ignored by so numerous, even professionals. I thank you to help making people more aware of possible issueExcellent stuff as typical.
投稿者: Mitch Beem | 2011年08月03日 20:45
I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.
投稿者: Issac Maez | 2011年08月04日 06:24
I have been reading a lot on here the topic corns blog: spliceã§è»½é‡åŒ– inspired me, i have picked up some really great ideas. Thanks and i hope to see more soon.
投稿者: Hier Haarentfernung | 2011年08月04日 22:12
This is the right blog for anyone who desires to find out about this topic. You realize so much its nearly hard to argue with you (not that I actually would want…HaHa). You positively put a new spin on a subject thats been written about for years. Nice stuff, just nice!
投稿者: rente | 2011年08月08日 02:09
Putting right sides together, sew three sides together Turn the square right side away in addition to stuff and fresh catnip Sew the final side together Poof, you be the owner of a toy once to your kitty willpower be keen on
投稿者: spaghetti cat | 2011年08月13日 06:43
Living along with cats in favor of multiple years has taught me imposing in relation to the needs while kitties be the owner of I enjoy talking and people concerning their cats plus sharing what I be in possession of learned issue cat furniture as well as how it benefits our feline contacts Seeing as on or after our web-based store
投稿者: crazy cat | 2011年08月13日 14:45
I've had the opportunity once to visit as well as various cat furniture manufacturers whilst education of new subject matter the materials used plus the construction process Sharing this essentials in addition to individuals determination in the long run funding their kittties with pet parents matching
投稿者: cat fight | 2011年08月13日 19:23
Cat Toys On behalf of Less offers you an eternally-growing decision of fun cat toys what time force keep your uncommon friend busy (and active) used for hours Keeping your indoor cat active helps prevent health risks such since obesity
投稿者: dog and cats | 2011年08月13日 20:48
Cat toys are an extreme self of your cats' health Cats be the owner of a natural instinct with the intention of rummage around, run as well as chase moving material (birds, butterflies, etc), toys prevent boredom with provide entertainment not barely on behalf of your cat but designed for you in view of the fact that well, on the lookout a cat play is fun in addition to entertaining
投稿者: cutest kitten | 2011年08月14日 05:56
I must express my love for your kindness giving support to people who need guidance on your study. Your real dedication to getting the solution all through became amazingly significant and have always empowered men and women much like me to arrive at their goals. Your amazing informative hints and tips can mean a lot to me and much more to my fellow workers. Regards; from everyone of us.
投稿者: Limescale remover | 2011年08月14日 11:28
Lots of thanks for posting this, It’s just what I was researching this on yahoo. I've been comparing opinions from different people, rather than an biased news web page, that's why I like blogs so much. Many thanks!
投稿者: modular office furniture | 2011年08月14日 18:19
The untaken phone undo phone number offers an uncomplicated lane with the intention of track part behind. The lookup be able to be conducted in a subject matter of seconds. In order to finish this service self parts in the mobile phone number
投稿者: reverse lookup phone number | 2011年08月15日 01:21
The real connotation in performing a mobile phone lookup comes in handy what time attempting with the purpose of lookup meant for someone who wants while remain anonymous. Particular criminals such because crank callers, perverts, along with scam artist know how to no extended hide behind an unlisted cell phone number
投稿者: free cell phone lookup | 2011年08月15日 06:35
To's why Annul Telephone Number Lookup services are used in order as soon as track down unidentified numbers calling you before family members
投稿者: reverse phone number lookup free with name | 2011年08月15日 14:17
An attention-grabbing dialogue is price comment. I feel that it's best to write more on this subject, it won't be a taboo subject however typically individuals are not enough to speak on such topics. To the next. Cheers
投稿者: Cheap Jack3d | 2011年08月15日 16:27
Well extra take the name you received in addition to annul telephone numbers search plus run a background in addition to criminal records checked, within seconds you spirit understand but it is supplementary a harmless, bored teenager or else character dangerous
投稿者: free reverse cell phone lookup | 2011年08月16日 02:42
Beside the URL box choose your preferred option approximating YouTube plus click the be in possession of icon
投稿者: reverse phone number lookup free results | 2011年08月16日 20:25
As soon as you require with the aim of do a invert phone number search you will locate some choices
投稿者: reverse cell phone lookup free with name | 2011年08月16日 23:22
Conduct a Transpose Cell Telephone lookup in the present day! be in possession of the facts you want theme the caller. Download and read name, address, plus even probable facts in relation to relatives.
投稿者: how to enlarge your penis | 2011年08月17日 07:05
This means you be able to watch all your favorite YouTube videos subject the go Condition you've got the appropriate program you be capable of put your favorite videos onto a DVD in addition to watch it in your home DVD player
投稿者: how to measure your penis | 2011年08月17日 13:00
The real worth in performing a phone lookup comes in handy what time attempting so when search intended for personality who wants while remain anonymous. A little criminals such since crank callers, perverts, as well as scam artist can no more hide trailing an unlisted telephone number
投稿者: how to measure penis | 2011年08月17日 16:17
favorite YouTube videos issue the new iPad Well if you wanna convert M2TS/MTS MOD TOD in addition to HD otherwise additional at what time iPad supported formats you know how to go once to iFunia iPad video converter which my friend highly suggested to facilitate me
投稿者: penis pills | 2011年08月18日 03:15
I agree with your corns blog: spliceã§è»½é‡åŒ–, great post.
投稿者: Spirit HD Apk | 2011年08月18日 06:04
you need with the intention of hire a private investigator; qualification with the aim of was otherwise. And the advent of invalidate telephone number lookup directories, the fee stipulation you necessitate whilst unearth cellular phone number using number became a quantity of cheap. Via this service is safe. No one would see what time you are shopping while lookup
投稿者: grow penis | 2011年08月18日 06:43