BitArray vs bool
#1

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

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
Reply
#3

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
Reply
#4

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.
Reply
#5

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
Reply
#6

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
Reply
#7

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
Reply
#8

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?
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)