0786ideal
(ideal)
October 27, 2024, 4:25pm
#1
Last week i decided to make chunk generation and chunk loading in roblox, when doing soo i’ve learned few things like pararrel luau that i never used before or about some chunk-loading techniques, but what i wonder about now is if using math i can optimize built-in functions like math library or vector methoods, i’ve heard that if process runs a lot of times or very often it’s reccomended to do it
Soo is using math better than roblox’s functions?
1 Like
bluepear_2
(bluepear_2)
October 27, 2024, 4:41pm
#2
i assume so
using math.clamp() is a lot faster and efficient than making a whole function for it
0786ideal
(ideal)
October 27, 2024, 4:46pm
#3
Hmmm, but what about functions like Magnitude, math.pow or math.sqrt? they seem very easy to recreate by using operators
bluepear_2
(bluepear_2)
October 27, 2024, 5:09pm
#4
im also pretty sure those ones are more efficient, also ALOT more convenient
I just did a test on my computer (CPU: 10900k)
I made a custom magnitude function with proper type declaration to make it as fast as possible. With 100 million tests for each function.
The built in magnitude function seems to be around 50% faster.
1 Like
0786ideal
(ideal)
October 27, 2024, 6:15pm
#6
Probably to make efficient custom function i need to use custom made coordinates and different shapes, still thx for tests and tips
Don’t bother. Vector3s are good enough. What are you trying to do?
1 Like
0786ideal
(ideal)
October 27, 2024, 6:41pm
#8
Overall chunk generation and chunk loading, i’m experimenting with most efficient methoods and stuff to make it good
Using built-in is faster, probably because I think these are C++ functions
1 Like
Then built in objects will be the fastest as these are not run in lua code but rather on a lower level which will minimize memory usage and speed.
Unless a function was HORRIBLY implemented directly by roblox, their built in methods for doing something will always be faster.
1 Like
system
(system)
Closed
November 10, 2024, 6:52pm
#11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.