Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Testing to see if ommitting the a in for a,b in pairs will actually make a difference.
- Test given:
- Folder with 1000 children, renaming them each loop.
- Test result:
- WITHOUT the a in a,b | Average time taken: 24641 nanoseconds - Client - SpeedBenchmark:23
- WITH the a in a,b | Average time taken: 24351 nanoseconds - Client - SpeedBenchmark:23
- Test code:
- local replicatedStorage = game.ReplicatedStorage
- local speed = require(replicatedStorage.SpeedBenchmark)
- local avg = {}
- for i = 1000, 1, -1 do
- local start = speed:placeStart()
- local name = 1
- for e, a in pairs(replicatedStorage.Children:GetChildren()) do
- if a then
- a.Name = tostring(name)
- end
- name = name + 1
- end
- speed:placeEnd(start, avg)
- end
- avg = {}
- for i = 1000, 1, -1 do
- local start = speed:placeStart()
- local name = 1
- for _, a in pairs(replicatedStorage.Children:GetChildren()) do
- if a then
- a.Name = tostring(name)
- end
- name = name + 1
- end
- speed:placeEnd(start, avg)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement