Testing bits may time more time than testing plain ints for small dimensions. For bigger dimensions however, it will become worth it - the second example uses about 32 times less memory (ignoring the overhead of having an array-object), and that means that more of it will stay in caches, which are much faster than main memory (which is very slow compared to a CPU). On today's machines, it is often the case that using more instructions so that you can use the cache better makes things much faster, however, when the entire thing is tiny to begin with, the overhead of testing bits would probably not be worth it.
There is an other case in which using "tiny bit-arrays" like the second example can work out really well: when you can exploit the fact that they're int
s instead of just accessing the bits individually. For example, if you intend to do boolean arithmetic on whole 32bit chunks at the time, or if you want to count the number of 1's, or if you want to get the lowest index that has a 1 (especially if you really wanted a mask instead of the index).