Efficiency of bitwise operations

Started by wynni2, Mon 18/02/2019 12:09:47

Previous topic - Next topic

wynni2

Hi all -

I'm working on a simple particle system for my game, and I'm curious about the efficiency of bitwise operators in AGS.

In principle I could store the coordinates of several particles in a single int, which could be more efficient (this is also a fun way to learn bitwise operations).

However, some older forum posts say that bitwise operations in AGS aren't faster (or might be a little slower) than standard logic. Does anyone know if this is still the case?

Thanks.

Crimson Wizard

#1
Well, obviously this will be at least a little slower because you will have to pack and unpack individual values, as opposed to simply using whole ints. So there will be extra operations.

How many particles do you have in mind though? If several thousands, I do not think it's worth it to bother at all.

Speaking of speed of operations, I do not believe bitwise operators are slower compared to arithmetic operations. The problem with AGS is that its script interpreter is slow on its own (slower than many popular modern script languages at least) and the difference in speed between particular operations may be negligible comparing to the whole time interpreter spends on executing any operation.


EDIT: oh, I forgot to mention, if you want smooth particle movement then their coordinates are probably better stored as floats instead.

SMF spam blocked by CleanTalk