mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-24 06:34:09 +00:00
Refactor stress test files to enhance clarity and performance
- Removed unnecessary references to LargeTreeGenerator in multiple stress test files, streamlining the code. - Simplified loop iterations by replacing index variables with underscores for unused values, improving readability. - Updated the diff logic in the reify and diff tests to eliminate unused patch variables, enhancing performance and clarity. - Ensured consistent formatting across stress test files for better maintainability.
This commit is contained in:
parent
d513ab16c0
commit
09a0f95d53
8 changed files with 12 additions and 20 deletions
|
|
@ -11,7 +11,6 @@ return function()
|
|||
local PatchSet = require(script.Parent.Parent.PatchSet)
|
||||
local testUtils = require(script.Parent.Parent.testUtils)
|
||||
local PatchGenerator = testUtils.PatchGenerator
|
||||
local LargeTreeGenerator = testUtils.LargeTreeGenerator
|
||||
|
||||
local HttpService = game:GetService("HttpService")
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ return function()
|
|||
|
||||
-- Fix up children references
|
||||
for id, virt in pairs(virtualInstances) do
|
||||
for i, childPlaceholder in ipairs(virt.Children) do
|
||||
for i, _ in ipairs(virt.Children) do
|
||||
-- Find the actual child ID
|
||||
for otherId, otherVirt in pairs(virtualInstances) do
|
||||
if otherVirt.Parent == id then
|
||||
|
|
@ -529,7 +529,7 @@ return function()
|
|||
},
|
||||
}
|
||||
|
||||
local ok, patch = diff(instanceMap, virtualInstances, rootId)
|
||||
local ok, _ = diff(instanceMap, virtualInstances, rootId)
|
||||
|
||||
expect(ok).to.equal(true)
|
||||
-- CFrame decoding might not work in test env, but the test structure is valid
|
||||
|
|
@ -957,7 +957,7 @@ return function()
|
|||
},
|
||||
}
|
||||
|
||||
local ok, patch = diff(instanceMap, virtualInstances, rootId)
|
||||
local ok, _ = diff(instanceMap, virtualInstances, rootId)
|
||||
|
||||
expect(ok).to.equal(true)
|
||||
-- Should be considered equal
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ return function()
|
|||
local PatchSet = require(script.Parent.Parent.PatchSet)
|
||||
local InstanceMap = require(script.Parent.Parent.InstanceMap)
|
||||
local testUtils = require(script.Parent.Parent.testUtils)
|
||||
local LargeTreeGenerator = testUtils.LargeTreeGenerator
|
||||
|
||||
local HttpService = game:GetService("HttpService")
|
||||
|
||||
|
|
@ -43,11 +42,9 @@ return function()
|
|||
-- Build virtual instances for 20-level deep tree
|
||||
local parentId = nil
|
||||
local rootId = nil
|
||||
local ids = {}
|
||||
|
||||
for i = 1, 20 do
|
||||
local id = generateId()
|
||||
table.insert(ids, id)
|
||||
|
||||
if rootId == nil then
|
||||
rootId = id
|
||||
|
|
@ -271,7 +268,7 @@ return function()
|
|||
local children = {}
|
||||
local invalidIds = {}
|
||||
|
||||
for i = 1, 5 do
|
||||
for _ = 1, 5 do
|
||||
local childId = generateId()
|
||||
table.insert(children, childId)
|
||||
table.insert(invalidIds, childId)
|
||||
|
|
@ -519,7 +516,7 @@ return function()
|
|||
describe("performance", function()
|
||||
it("should create 200+ instances in reasonable time", function()
|
||||
local instanceMap = InstanceMap.new()
|
||||
local treeData = LargeTreeGenerator.createVirtualTree({
|
||||
local treeData = testUtils.LargeTreeGenerator.createVirtualTree({
|
||||
depth = 3,
|
||||
width = 6, -- 6^3 = 216 instances
|
||||
instanceType = "Folder",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue