Optimization....
Blitz3D Forums/Blitz3D Programming/Optimization....
| ||
when i use the code For type.type = each type update type next the program updates each types previously created... Everything is good if the number of types updated is sensible... but when i want to update a lot of types (40000 for example!!) the program will slow down............. Is there any solution to this? |
| ||
all depends on what amount of data each type holds plus the more types it has to go through the slower it will become. Add a check before you update each type so only the ones which pass the checks will get updated ie a simple example would be only update the types which have an id=1 etc. |
| ||
but when i want to update a lot of types (40000 for example!!) the program will slow down............. You think? |
| ||
What are you using 40,000 types for? That's what I'd like to know. |
| ||
In order not to perceive the slowdown so much, you would have to do it in "chunks" iterating manually through the list. ; do in loop for certain amount of time t.typ = after t update t ; update world or something -- do other game stuff, and then return to above If you NEED to update all the types during each frame, you may be in trouble, and you may wish to re-visit your design. (You may wish to re-visit your design anyway...) |
| ||
"You think? " if he wanted sarcasm i would have done it :) |
| ||
I don't understand this 'update types' business. Can't find it under '2D a-z'. What's that all about? BTW - It is possible to access types as an array. Does that help? |
| ||
"update type" is pseudocode for "do whatever you're doing to each custom type instance" it's not literal |
| ||
Ahh! Thanks soja. It's good to be in the know. |
| ||
>In order not to perceive the slowdown so much, you would >have to do it in "chunks" iterating manually through the >list. Definately the way to go. I am still in the midst of optimizing a custom pixel based 2d renderer, but I can tell you that I have increased the FPS from 30 to 80+ by splitting up my code between screen updates. On my screen I have a large section being 640x336 pixels = 210,540 pixels to be updated. I assume in BlitzPlus I could push this much further.. but Time&Money, and Money&Time.. I have neither. ::sigh:: I am a sucker for optimizing code. Sucker><Expert !! ;^) |