SA-MP Forums Archive
BitArray vs bool - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: BitArray vs bool (/showthread.php?tid=655373)



BitArray vs bool - IdonTmiss - 19.06.2018

Hmm so yeah BitArray is smaller yeah, but is it faster than bool?


Re: BitArray vs bool - Banditul18 - 19.06.2018

BitArray have a bit of magic behind it isnt a default pawn thing as bool so is slower just because of that magic.
But i rather not judge by the speed, if BitArray is the thing that i need to make something i use it not metter if is 0.001s faster or slower


Re: BitArray vs bool - IdonTmiss - 19.06.2018

Quote:
Originally Posted by Banditul18
Посмотреть сообщение
BitArray have a bit of magic behind it isnt a default pawn thing as bool so is slower just because of that magic.
But i rather not judge by the speed, if BitArray is the thing that i need to make something i use it not metter if is 0.001s faster or slower
Well you see I have a pretty big script and I have about 90/100 players daily or even 200 sometimes so I really need that "speed" of loading and doing stuff on the server


Re: BitArray vs bool - Private200 - 19.06.2018

If I am not wrong, Emmet had a tutorial about BitArrays; showing their usage and also giving some general information about it. I do not know if it is still around or deleted with his account removal, but you might find it useful.


Re: BitArray vs bool - Ada32 - 20.06.2018

bools i believe are still 4 bytes in pawn and all a bit array is an array of well..bits.. (very useful for flagging etc..)

ysi actually has a neat little library (y_bitarray i believe) that has both y_iterate and y_groups support (made my days a heck-of-alot easier in the past) you should check it out

i actually have a mode somewhere in my treasure chest written with (mainly) ysi and it's magic (i'll have to dig deep but i may release it if i can find it)

too bad ****** went crazy lol


Re: BitArray vs bool - IdonTmiss - 20.06.2018

Quote:
Originally Posted by Ada32
Посмотреть сообщение
bools i believe are still 4 bytes in pawn and all a bit array is an array of well..bits.. (very useful for flagging etc..)

ysi actually has a neat little library (y_bitarray i believe) that has both y_iterate and y_groups support (made my days a heck-of-alot easier in the past) you should check it out

i actually have a mode somewhere in my treasure chest written with (mainly) ysi and it's magic (i'll have to dig deep but i may release it if i can find it)

too bad ****** went crazy lol
yeah i know they are still 4 bytes but im talking about speed


Re: BitArray vs bool - Calisthenics - 20.06.2018

If your concern is speed and still want to make the output file smaller, there are 2 more options:

• char-arrays
• bit-flags

Take a look here: https://sampforum.blast.hk/showthread.php?tid=216730


Re: BitArray vs bool - IdonTmiss - 20.06.2018

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
If your concern is speed and still want to make the output file smaller, there are 2 more options:

• char-arrays
• bit-flags

Take a look here: https://sampforum.blast.hk/showthread.php?tid=216730
Soo yeah, use bools and char?


Re: BitArray vs bool - Ada32 - 20.06.2018

Quote:
Originally Posted by Calisthenics
If your concern is speed and still want to make the output file smaller, there are 2 more options:

• char-arrays
• bit-flags

Take a look here: https://sampforum.blast.hk/showthread.php?tid=216730
why should he be concerned about the output file size?

not sure why everyone's so concerned with speed. it's not like it's the compiler's job to optimize your code or anything


Re: BitArray vs bool - Logic_ - 21.06.2018

I'd say make your gamemode more read-able and optimized by re-writing it a few times and stress test it. Just using char arrays or bit flags will NOT make it fast. Char arrays are slower than normal arrays but are good for saving on memory if necessary.