Closed gibson042 closed 10 months ago
and XS (+39%), presumably because of rope optimizations.
But XS doesn't use ropes.
@phoddie , shouldn't we generally use repeated array push + join in XS rather than repeated string appends? Does it make sense the latter could be faster?
@erights – Correct, XS doesn't use ropes. Perhaps for strings created for a smaller number of items, using string concatenation is faster but as the number of items grows, the array push + join approach is faster?
If not, I suggest that this PR be closed in favor of the status quo.
Close?
Given the above, it seems like small-input performance improvements do not provide sufficient benefit to justify introducing the pattern.
Description
Noticed in passing: building a string by successive concatenation rather than pushing into an eventually-
join
ed array is faster in both V8 (+63%) and XS (+39%), presumably because of rope optimizations.Moddable XS
useRaw: 0.61 ops/ms useJoin: 0.62 ops/ms usePlus: 0.86 ops/ms useTemplates: 0.72 ops/ms
V8
useRaw: 2.72 ops/ms useJoin: 4.65 ops/ms usePlus: 7.58 ops/ms useTemplates: 7.35 ops/ms
Security Considerations
n/a
Scaling Considerations
:+1:
Documentation Considerations
n/a
Testing Considerations
all tests continue to pass
Upgrade Considerations
None beyond the usual concerns about changing vat bundles.