I understand that bitwise operations, especially in compiled-languages such as C & C++
can be used as a form of optimization for some equations, such as the following :
local a : number = 82384 / 64;
can also be performed using :
local a : number = Bit32.rshift(82384, 7);
Or in a language like C
int a = (int) (82384 >> 7)
For those who are not aware : bitwise operations closely represent the structure of a CPU.
and depending on different factors like the compiler you use, and the CPU architecture.
some Bitwise operations can be performed in a single CPU Cycle, with some
Arithmetic operators taking anywhere from 20-24,000 CPU Cycles.
Which can be a heavily optimization for some programs.
My thought process : is that ROBLOX uses a fork of Lua, which is an interpreted language, which uses it’s own Virtual machine, which then runs on your hardware & “interprets” a script, so it may not have the same benefits you receive from a compiled language. Although the ROBLOX Engine does use C++, and the Bit32 Library itself uses C++, so using said library may be able to take advantage of the optimization if it doesn’t run on the Lua VM.
What have I tried? : I’ve tried optimizing equations with bitwise operators in the past using several compiled languages with compatibility, and have found this to be a valid optimization, I’ve also looked in several places such as the LuaU Documentation Library - Luau, and the ROBLOX API Reference bit32 | Roblox Creator Documentation
Although both only provide usage-related information.