Skip to content

Commit

Permalink
Release Fusion early beta
Browse files Browse the repository at this point in the history
  • Loading branch information
dphfox committed Aug 20, 2021
1 parent f772305 commit f25e199
Show file tree
Hide file tree
Showing 75 changed files with 16,594 additions and 0 deletions.
36 changes: 36 additions & 0 deletions benchmark/Colour/Oklab.bench.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
local Package = game:GetService("ReplicatedStorage").Fusion
local Oklab = require(Package.Colour.Oklab)

return {

{
name = "Convert to Oklab",
calls = 50000,

preRun = function()
return {
colour = Color3.new(0.25, 0.5, 0.75)
}
end,

run = function(state)
Oklab.to(state.colour)
end
},

{
name = "Convert from Oklab",
calls = 50000,

preRun = function()
return {
colour = Vector3.new(0.25, 0.5, 0.75)
}
end,

run = function(state)
Oklab.from(state.colour)
end
}

}
23 changes: 23 additions & 0 deletions benchmark/Dependencies/captureDependencies.bench.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
local Package = game:GetService("ReplicatedStorage").Fusion
local captureDependencies = require(Package.Dependencies.captureDependencies)

local function callback()

end

return {

{
name = "Capture dependencies from callback",
calls = 50000,

preRun = function()
return {}
end,

run = function(state)
captureDependencies(state, callback)
end
}

}
104 changes: 104 additions & 0 deletions benchmark/Dependencies/updateAll.bench.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
local Package = game:GetService("ReplicatedStorage").Fusion
local updateAll = require(Package.Dependencies.updateAll)

local function update()
return true
end

local function makeDependency(dependency, dependent)
dependent.dependencySet[dependency] = true
dependency.dependentSet[dependent] = true
end

return {

{
name = "Update empty tree",
calls = 50000,

preRun = function()
local root = { dependentSet = {} }
return root
end,

run = function(state)
updateAll(state)
end
},

{
name = "Update shallow tree",
calls = 50000,

preRun = function()
local root = { dependentSet = {} }
local A = { dependentSet = {}, dependencySet = {}, update = update}
local B = { dependentSet = {}, dependencySet = {}, update = update}
local C = { dependentSet = {}, dependencySet = {}, update = update}
local D = { dependentSet = {}, dependencySet = {}, update = update}

makeDependency(root, A)
makeDependency(root, B)
makeDependency(root, C)
makeDependency(root, D)

return root
end,

run = function(state)
updateAll(state)
end
},

{
name = "Update deep tree",
calls = 50000,

preRun = function()
local root = { dependentSet = {} }
local A = { dependentSet = {}, dependencySet = {}, update = update}
local B = { dependentSet = {}, dependencySet = {}, update = update}
local C = { dependentSet = {}, dependencySet = {}, update = update}
local D = { dependentSet = {}, dependencySet = {}, update = update}

makeDependency(root, A)
makeDependency(A, B)
makeDependency(B, C)
makeDependency(C, D)

return root
end,

run = function(state)
updateAll(state)
end
},

{
name = "Update tree with complex dependencies",
calls = 50000,

preRun = function()
local root = { dependentSet = {} }
local A = { dependentSet = {}, dependencySet = {}, update = update}
local B = { dependentSet = {}, dependencySet = {}, update = update}
local C = { dependentSet = {}, dependencySet = {}, update = update}
local D = { dependentSet = {}, dependencySet = {}, update = update}

makeDependency(root, A)
makeDependency(A, B)
makeDependency(B, C)
makeDependency(C, D)
makeDependency(A, C)
makeDependency(A, D)
makeDependency(B, D)

return root
end,

run = function(state)
updateAll(state)
end
}

}
147 changes: 147 additions & 0 deletions benchmark/Instances/New.bench.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
local Package = game:GetService("ReplicatedStorage").Fusion
local New = require(Package.Instances.New)
local Children = require(Package.Instances.Children)
local OnEvent = require(Package.Instances.OnEvent)
local OnChange = require(Package.Instances.OnChange)
local State = require(Package.State.State)

local function callback()

end

return {

{
name = "New without properties",
calls = 50000,

run = function()
New "Frame" {}
end
},

{
name = "New with properties - constant",
calls = 50000,

run = function()
New "Frame" {
Name = "Foo"
}
end
},

{
name = "New with properties - state",
calls = 50000,

run = function()
New "Frame" {
Name = State("Foo")
}
end
},

{
name = "New with Parent - constant",
calls = 10000,

preRun = function()
end,

run = function(parent)
New "Folder" {
Parent = Instance.new("Folder")
}
end
},

{
name = "New with Parent - state",
calls = 10000,

preRun = function()
return Instance.new("Folder")
end,

run = function(parent)
New "Folder" {
Parent = State(parent)
}
end,

postRun = function(parent)
parent:Destroy()
end
},

{
name = "New with Children - single",
calls = 50000,

preRun = function()
return New "Folder" {}
end,

run = function(child)
New "Frame" {
[Children] = child
}
end
},

{
name = "New with Children - array",
calls = 50000,

preRun = function()
return {
New "Folder" {}
}
end,

run = function(children)
New "Frame" {
[Children] = children
}
end
},

{
name = "New with Children - state",
calls = 50000,

preRun = function()
return New "Folder" {}
end,

run = function(child)
New "Frame" {
[Children] = State(child)
}
end
},

{
name = "New with OnEvent",
calls = 50000,

run = function()
New "Frame" {
[OnEvent "MouseEnter"] = callback
}
end
},

{
name = "New with OnChange",
calls = 50000,

run = function()
New "Frame" {
[OnChange "Name"] = callback
}
end
}

}
Loading

0 comments on commit f25e199

Please sign in to comment.