Apeirogon wrote:Im lost point of what you try to achieve after second page of discussion, soo....what you try to achieve? Are actions with arrays really slow? You definitely dont want increase array efficiency just to increase array efficiency.
Also said graf in the first post "if actions with array causes performance issues, you use it wrong". So probably you use them wrong?
The way I understand it, Major Cooke is providing a library of pre-built ZScript tools. One of those tools provides quick access to a user-defined subset of a map's actors. This is important, because, done incorrectly (iterating through thinkers, for example), performance issues can occur.
Major Cooke wrote:kb1 wrote:Heh, alright, you got me. Took me long enough to figure it out. Here' I'm thinking you're being serious...
I was in fact being completely serious. I wasn't joking around.
Oops, sorry about that.
Listen, I can't speak for others. But I know what I wrote probably delivers, and that it probably wails. (profile, as always). But, it's a system - don't expect it to work piecemeal. I continued to explain, because I want you to have the best - that's the gig, for me. Any less is... less. It's just not fun for me otherwise.
Major Cooke wrote:So many things to consider. Sheesh... So torn on which one to stick with, but honestly, since they only happen once every X seconds, I think this is one of those things where it can safely go either way and have no performance impact since they both work relatively well due to happening so infrequently.
Are you sure about X second intervals, and not sooner? I ask, because: Isn't this for a library that others are going to use, at random intervals to parse through the active actor list? You can't depend on them waiting X seconds, can you? That's why I've been concerned with performance. I've been assuming that a library user might wish to run through the actors, say, every other tic, which is why it's so important to keep *their iterations* minimal and blazingly fast...not just *your* Clean function's iterations. Maybe you see the library being used differently?
Major Cooke wrote:I have yet to decide fully which one I'm going for. Trying to measure which one is best is almost impossible, unless I were to try and constantly run them every single tic I suppose.
If you can forego some accuracy, and you just want to compare the performance of two similar scripts, this might do the trick:
1. Make a simple map with 2 very large rooms.
2. Edit the map by adding 2500 imps.
3. Save map, and start up the game.
4. Play the map, and turn on FPS counter.
5. Repeat steps 2 thru 5 until the FPS dips below 35.
6. Take out 1000 monsters until the average FPS goes back up to 35.
You should now have a map that just barely starts to lag on your computer. Now, you can add your ZScript library. Any custom function that uses actors in this map is going to be *really sensitive* to the performance of your code. In other words, even a slight slowdown is going to be greatly multiplied by imp count + imp missile count. Imps are good, because, as they fire missiles, the actor count is going to go way up. And, when the missiles explode, you're going to get *a lot* of NULLs scattered within your arrays.
*And*, if you use a command that does a "kill all", and you happen to be doing something like SlotCount, those iterations should quickly drop all the way to 0, even while the array still has thousands of elements. That's what I've been describing for multiple pages.
You know, most likely, your library will be really fast, anyway. But, someone will always find a way to write really slow code using your fast library! There's nothing wrong a a little bit of performance tuning.
Anyway, if you decide, one way or another, and you happen to feel like doing some performance profiling, drop a reply here if you would. Thanks.