Efficient Vehicle Looping
#20

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
A bitset actually would have little to no advantages compared to the common loop
pawn Код:
// Common attempt
for (new i = 0; i < MAX_VEHICLES; i++) {
    if (!IsVehicleStreamedIn(i, playerid)) continue;
}

// Bitset (some pawn/c++ pseudo mixup)
for (new i = 0; i < MAX_VEHICLES; i++) {
    if (!bitset_playervehicles[playerid].test(i)) continue;
}
I did not mention an advantage over looping with function usage. I mentioned a clear memory consumption advantage vs the regular PAWN array -- 32 times less memory usage (technically, I assume the container keeps some other properties to satisfy the standard requirements). That is, after all, if you're going to have an array around, if someone's an advocate of that approach. So my text about bitset was just in case someone is going to need an array for some situation, there's no need to allocate 32bits for what can fit in 1bit.

Back to the original point, as I said, it is an infrequent algorithm so don't spend time optimizing it if you're not going to get it back from run-time gains.

Good luck.
Reply


Messages In This Thread
Efficient Vehicle Looping - by MP2 - 05.05.2015, 08:56
Re: Efficient Vehicle Looping - by AIped - 05.05.2015, 09:08
Re: Efficient Vehicle Looping - by MicroD - 05.05.2015, 09:22
Re: Efficient Vehicle Looping - by Tamer - 05.05.2015, 09:43
Re: Efficient Vehicle Looping - by MP2 - 05.05.2015, 09:54
Re: Efficient Vehicle Looping - by Tamer - 05.05.2015, 10:00
Re: Efficient Vehicle Looping - by Misiur - 05.05.2015, 10:01
Re: Efficient Vehicle Looping - by Lordzy - 05.05.2015, 10:10
Re: Efficient Vehicle Looping - by MP2 - 05.05.2015, 10:29
Re: Efficient Vehicle Looping - by Konstantinos - 05.05.2015, 10:38
Re: Efficient Vehicle Looping - by MP2 - 05.05.2015, 10:51
Re: Efficient Vehicle Looping - by Kar - 05.05.2015, 21:28
Re: Efficient Vehicle Looping - by Emmet_ - 05.05.2015, 21:45
Re: Efficient Vehicle Looping - by Crayder - 05.05.2015, 21:59
Re: Efficient Vehicle Looping - by MP2 - 06.05.2015, 10:22
Re: Efficient Vehicle Looping - by AndreT - 06.05.2015, 11:51
Re: Efficient Vehicle Looping - by Mauzen - 06.05.2015, 13:31
Re: Efficient Vehicle Looping - by sammp - 06.05.2015, 14:57
Re: Efficient Vehicle Looping - by Tamer - 06.05.2015, 17:57
Re: Efficient Vehicle Looping - by AndreT - 06.05.2015, 19:31
Re: Efficient Vehicle Looping - by Marricio - 08.05.2015, 21:22
Re: Efficient Vehicle Looping - by Pottus - 09.05.2015, 01:39

Forum Jump:


Users browsing this thread: 1 Guest(s)