-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Marcus <ukendio@gmail.com> Co-authored-by: Jack T <jack@jackt.space>
- Loading branch information
1 parent
18e5b29
commit 4c1dca1
Showing
15 changed files
with
966 additions
and
600 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--!optimize 2 | ||
--!native | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Matter = require(ReplicatedStorage.Matter) | ||
local PinnedMatter = require(ReplicatedStorage.PinnedMatter) | ||
|
||
local A, B = Matter.component(), Matter.component() | ||
local pinnedA, pinnedB = PinnedMatter.component(), PinnedMatter.component() | ||
|
||
local N = 500 | ||
|
||
return { | ||
ParameterGenerator = function() | ||
local world, pinnedWorld = Matter.World.new(), PinnedMatter.World.new() | ||
for i = 1, N do | ||
world:spawnAt(i) | ||
pinnedWorld:spawnAt(i) | ||
end | ||
|
||
return world, pinnedWorld | ||
end, | ||
|
||
Functions = { | ||
["Matter 0.9"] = function(_, world) | ||
for i = 1, N do | ||
world:insert(i, A({ i })) | ||
end | ||
end, | ||
["Matter 0.8.4"] = function(_, _, world) | ||
for i = 1, N do | ||
world:insert(i, A({ i })) | ||
end | ||
end, | ||
}, | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--!optimize 2 | ||
--!native | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Matter = require(ReplicatedStorage.Matter) | ||
local PinnedMatter = require(ReplicatedStorage.PinnedMatter) | ||
|
||
local world = Matter.World.new() | ||
local pinnedWorld = PinnedMatter.World.new() | ||
|
||
local A, B = Matter.component(), Matter.component() | ||
local pinnedA, pinnedB = PinnedMatter.component(), PinnedMatter.component() | ||
|
||
for i = 1, 10_000 do | ||
world:spawnAt(i, A({}), B({})) | ||
pinnedWorld:spawnAt(i, pinnedA({}), pinnedB({})) | ||
end | ||
|
||
return { | ||
ParameterGenerator = function() | ||
return | ||
end, | ||
|
||
Functions = { | ||
["Matter 0.9"] = function() | ||
local query = world:query(A, B) | ||
for _ = 1, 1_000 do | ||
query:next() | ||
end | ||
end, | ||
["Matter 0.8.4"] = function() | ||
local query = pinnedWorld:query(pinnedA, pinnedB) | ||
for _ = 1, 1_000 do | ||
query:next() | ||
end | ||
end, | ||
}, | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
--!optimize 2 | ||
--!native | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Matter = require(ReplicatedStorage.Matter) | ||
local PinnedMatter = require(ReplicatedStorage.PinnedMatter) | ||
|
||
local world = Matter.World.new() | ||
local pinnedWorld = PinnedMatter.World.new() | ||
|
||
local A, B, C, D, E, F, G = | ||
Matter.component(), | ||
Matter.component(), | ||
Matter.component(), | ||
Matter.component(), | ||
Matter.component(), | ||
Matter.component(), | ||
Matter.component() | ||
local pinnedA, pinnedB, pinnedC, pinnedD, pinnedE, pinnedF, pinnedG = | ||
PinnedMatter.component(), | ||
PinnedMatter.component(), | ||
PinnedMatter.component(), | ||
PinnedMatter.component(), | ||
PinnedMatter.component(), | ||
PinnedMatter.component(), | ||
PinnedMatter.component() | ||
|
||
local function flip() | ||
return math.random() > 0.5 | ||
end | ||
|
||
local archetypes = {} | ||
for i = 1, 30_000 do | ||
local id = i | ||
world:spawnAt(id) | ||
pinnedWorld:spawnAt(id) | ||
|
||
local str = "" | ||
if flip() then | ||
world:insert(id, A({ a = true, id = i })) | ||
pinnedWorld:insert(id, pinnedA({ a = true, id = i })) | ||
str ..= "A_" | ||
end | ||
if flip() then | ||
world:insert(id, B({ b = true, id = i })) | ||
pinnedWorld:insert(id, pinnedB({ b = true, id = i })) | ||
str ..= "B_" | ||
end | ||
if flip() then | ||
world:insert(id, C({ c = true, id = i })) | ||
pinnedWorld:insert(id, pinnedC({ c = true, id = i })) | ||
str ..= "C_" | ||
end | ||
if flip() then | ||
world:insert(id, D({ d = true, id = i })) | ||
pinnedWorld:insert(id, pinnedD({ d = true, id = i })) | ||
str ..= "D_" | ||
end | ||
if flip() then | ||
world:insert(id, E({ e = true, id = i })) | ||
pinnedWorld:insert(id, pinnedE({ e = true, id = i })) | ||
str ..= "E_" | ||
end | ||
if flip() then | ||
world:insert(id, F({ f = true, id = i })) | ||
pinnedWorld:insert(id, pinnedF({ f = true, id = i })) | ||
str ..= "F_" | ||
end | ||
if flip() then | ||
world:insert(id, G({ g = true, id = i })) | ||
pinnedWorld:insert(id, pinnedG({ g = true, id = i })) | ||
str ..= "G" | ||
end | ||
|
||
archetypes[str] = (archetypes[str] or 0) + 1 | ||
end | ||
|
||
local total = 0 | ||
for _ in archetypes do | ||
total += 1 | ||
end | ||
|
||
print(total, "different archetypes") | ||
|
||
return { | ||
ParameterGenerator = function() | ||
return | ||
end, | ||
|
||
Functions = { | ||
["Matter 0.8.4"] = function() | ||
local count = 0 | ||
for _ in pinnedWorld:query(pinnedB, pinnedA) do | ||
count += 1 | ||
end | ||
end, | ||
["Matter 0.9"] = function() | ||
local count = 0 | ||
for _ in world:query(B, A) do | ||
count += 1 | ||
end | ||
end, | ||
}, | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--!optimize 2 | ||
--!native | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Matter = require(ReplicatedStorage.Matter) | ||
local PinnedMatter = require(ReplicatedStorage.PinnedMatter) | ||
|
||
local world = Matter.World.new() | ||
local pinnedWorld = PinnedMatter.World.new() | ||
|
||
local A, B, C, D, E, F, G = | ||
Matter.component(), | ||
Matter.component(), | ||
Matter.component(), | ||
Matter.component(), | ||
Matter.component(), | ||
Matter.component(), | ||
Matter.component() | ||
local pinnedA, pinnedB, pinnedC, pinnedD, pinnedE, pinnedF, pinnedG = | ||
PinnedMatter.component(), | ||
PinnedMatter.component(), | ||
PinnedMatter.component(), | ||
PinnedMatter.component(), | ||
PinnedMatter.component(), | ||
PinnedMatter.component(), | ||
PinnedMatter.component() | ||
|
||
local function flip() | ||
return math.random() > 0.5 | ||
end | ||
|
||
for i = 1, 50_000 do | ||
local id = i | ||
world:spawnAt(id) | ||
pinnedWorld:spawnAt(id) | ||
|
||
if flip() then | ||
world:insert(id, A({ a = true, id = i })) | ||
pinnedWorld:insert(id, pinnedA({ a = true, id = i })) | ||
end | ||
if flip() then | ||
world:insert(id, B({ b = true, id = i })) | ||
pinnedWorld:insert(id, pinnedB({ b = true, id = i })) | ||
end | ||
if flip() then | ||
world:insert(id, C({ c = true, id = i })) | ||
pinnedWorld:insert(id, pinnedC({ c = true, id = i })) | ||
end | ||
if flip() then | ||
world:insert(id, D({ d = true, id = i })) | ||
pinnedWorld:insert(id, pinnedD({ d = true, id = i })) | ||
end | ||
if flip() then | ||
world:insert(id, E({ e = true, id = i })) | ||
pinnedWorld:insert(id, pinnedE({ e = true, id = i })) | ||
end | ||
if flip() then | ||
world:insert(id, F({ f = true, id = i })) | ||
pinnedWorld:insert(id, pinnedF({ f = true, id = i })) | ||
end | ||
if flip() then | ||
world:insert(id, G({ g = true, id = i })) | ||
pinnedWorld:insert(id, pinnedG({ g = true, id = i })) | ||
end | ||
end | ||
|
||
return { | ||
ParameterGenerator = function() | ||
return | ||
end, | ||
|
||
Functions = { | ||
["Matter 0.8.4"] = function() | ||
local count = 0 | ||
for _ in pinnedWorld:query(pinnedB):without(pinnedC) do | ||
count += 1 | ||
end | ||
end, | ||
["Matter 0.9"] = function() | ||
local count = 0 | ||
for _ in world:query(B):without(C) do | ||
count += 1 | ||
end | ||
end, | ||
}, | ||
} |
This file contains 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
Oops, something went wrong.