mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Refactor encoding logic in ChangeBatcher and improve matching depth handling
- Simplified the `isReadable` condition in `encodeService` for better readability. - Updated the `ServiceChunk` structure to conditionally include properties and references only if they exist, enhancing data efficiency. - Introduced a `MAX_SCORING_DEPTH` constant in the matching module to limit recursion depth, improving performance and preventing potential stack overflow issues. - Refactored the `computePairCost` and `matchChildren` functions to incorporate the new depth parameter, ensuring accurate cost calculations during matching. These changes enhance the clarity and efficiency of the encoding and matching processes, contributing to overall performance improvements.
This commit is contained in:
parent
e0fd9077e8
commit
a823db0297
5 changed files with 34 additions and 21 deletions
|
|
@ -24,8 +24,7 @@ return function(service: Instance)
|
|||
continue
|
||||
end
|
||||
|
||||
local isReadable = propertyMeta.scriptability == "ReadWrite"
|
||||
or propertyMeta.scriptability == "Read"
|
||||
local isReadable = propertyMeta.scriptability == "ReadWrite" or propertyMeta.scriptability == "Read"
|
||||
local doesSerialize = propertyMeta.serialization ~= "DoesNotSerialize"
|
||||
|
||||
if isReadable and doesSerialize then
|
||||
|
|
@ -66,10 +65,15 @@ return function(service: Instance)
|
|||
end
|
||||
end
|
||||
|
||||
return {
|
||||
local chunk = {
|
||||
className = service.ClassName,
|
||||
data = data,
|
||||
properties = properties,
|
||||
refs = refs,
|
||||
}
|
||||
if next(properties) then
|
||||
chunk.properties = properties
|
||||
end
|
||||
if next(refs) then
|
||||
chunk.refs = refs
|
||||
end
|
||||
return chunk
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue