Created
September 4, 2019 22:01
-
-
Save howmanysmall/3d8ca8e50fc90aa6df326bdf31cb1916 to your computer and use it in GitHub Desktop.
Array insertion methods.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Functions = {} | |
Functions["table.insert"] = function() | |
local Array = {} | |
for Index = 1, 1E4 do | |
table.insert(Array, Index * 2) | |
end | |
end | |
Functions["#X + 1"] = function() | |
local Array = {} | |
for Index = 1, 1E4 do | |
Array[#Array + 1] = Index * 2 | |
end | |
end | |
Functions["Length"] = function() | |
local Array = {} | |
local Length = 0 | |
for Index = 1, 1E4 do | |
Length = Length + 1 | |
Array[Length] = Index * 2 | |
end | |
end | |
require(2110831719).new(1, "Array Insertion 1", Functions) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Functions = {} | |
local Array = {} | |
for Index = 1, math.random(1E4) do Array[Index] = Index * 2 end | |
Functions["table.insert"] = function() | |
for Index = 1, 1E4 do | |
table.insert(Array, Index * 2) | |
end | |
end | |
Functions["#X + 1"] = function() | |
for Index = 1, 1E4 do | |
Array[#Array + 1] = Index * 2 | |
end | |
end | |
Functions["Length"] = function() | |
local Length = #Array | |
for Index = 1, 1E4 do | |
Length = Length + 1 | |
Array[Length] = Index * 2 | |
end | |
end | |
require(2110831719).new(1, "Array Insertion 2", Functions) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment