-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: optimize hot paths and reduce overhead for low-end devices (#368)
* perf: compare values directly instead of includes * perf: compare first character via access index instead of startsWith * perf: use Set + has instead of an array with includes * perf(shared): implement split once for fixKeyCase and resolveMetaKeyType * feat(shared): introduce thenable helper * perf(shared): use thenable in normalise for reduce async/await functions * perf(dom): use promise chain instead of async function in debouncedRenderDOMHead * chore(dom): remove async modifier for debouncedRenderDOMHead * perf(shared): remove unnecessary array spread in tagDedupeKey * refactor: undefined is allowed for spread object * perf(schema-org): avoid new array allocation in dedupeMerge * perf(dom): check empty class or style in foreach instead of allocation of filter * perf(dom): implement split once for style in trackCtx * perf(dom): convert tag name to lowercase once in renderDOMHead * refactor: compare with undefined without typeof in safe places * test(shared): add benchmark for processTemplateParams * perf(shared): move sub to top module in templateParams * perf(shared): avoid unnecessary operations in processTemplateParams * perf(shared): use single replacer in processTemplateParams * refactor(dom): move condition to else in renderDOMHead * perf(shared): combine filter in normaliseStyleClassProps * perf(shared): optimize normaliseEntryTags for handle tag promises * refactor: use arrow function instead of regular anonymous * perf(shared): cache allowed meta properties for tagDedupeKey * perf(shared): use concurrency chain instead of Promise.all in normaliseEntryTags * perf(unhead): allocate once third party dedupe keys in dedupe plugin * refactor(shared): remove second parameter in tagDedupeKey * fix(shared): normalise should handle consistently * perf(shared): reduce overhead from object.entries and map in normaliseEntryTags * perf(shared): promise should be edge case in normaliseProps * chore(shared): remove export from nestedNormaliseProps * perf(shared): promise should be edge case in normaliseEntryTags * fix(shared): switch condition in for i in nestedNormaliseEntryTags * chore(shared): rename resolvedTags to tagPromises in nestedNormaliseEntryTags * perf(shared): reduce overhead by using thenable in normaliseProps * perf(shared): promise should be edge case in normaliseTag * perf(shared): use for of instead of forEach in normaliseTag * perf(unhead): move common props to top of module in dedupe plugin * perf(unhead): use for in instead of object values in dedupe plugin * perf(unhead): use for of instead of forEach in dedupe plugin * perf(unhead): use for in instead of object entries in eventHandler plugin is a double acceleration of the plugin * perf(unhead): use slice & substring instead of replace in eventHandler * perf(unhead): move filter into loop body in sort plugin * perf(unhead): use substring instead of replace in sort plugin * perf(unhead): swap the loops in the sorting plugin * perf(shared): simplify complexity in tagWeight * perf(unhead): combine sorts in sort plugin * perf(unhead): reduce complexity to search in templateParams plugin * perf(unhead): move filter into loop body in templateParams plugin * perf(unhead): find and remove once templateParams tag in templateParams plugin * perf(unhead): improve contentAttrs handle in templateParams plugin * perf(unhead): speed up payload plugin using one loop * perf(unhead): compute props keys after static in dedupe plugin * perf(unhead): use splice instead of delete index + filter in titleTemplate plugin * perf(unhead): first check hasProps in dedupe plugin * perf(unhead): handle classes & styles without loop in dedupe plugin * perf(unhead): use object with null prototype in dedupe plugin * perf(unhead): use for of loop instead of map for patch entry * perf(dom): use for in loop for props instead of Object.entries in renderDOMHead * perf(dom): use for in loop for handle _eventHandlers in renderDOMHead * perf(dom): clear side effects in for in loop in renderDOMHead * perf(dom): replace loop with a direct property check for textContent and innerHTML * perf(dom): remove cast to array HTMLCollection in renderDOMHead * perf(unhead): speed up hashTag using for in loop & early returns * perf(vue): reduce overhead from resolveUnrefHeadInput * perf(dom): use set to store taken dedupe keys * perf(ssr): use string concatenation in propsToString * perf(ssr): add space before attrs in propsToString * perf(ssr): use string concatenation in ssrRenderTags * perf(ssr): use object.assign instead of spread operator * perf(shared): use for of instead of array map * perf(shared): check the static string first in fixKeyCase * perf(shared): use for in & for of loops in meta * perf(schema-org): use for in loop in resolveNodeId * perf(schema-org): use for in loop in stripEmptyProperties * perf(unhead): delete tag._duped if exists in dedupe plugin * perf(unhead): remove loop for check third party dedupe keys in dedupe plugin * perf(shared): reduce operations in eventHandler plugin
- Loading branch information
Showing
47 changed files
with
693 additions
and
346 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
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
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
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
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
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
Oops, something went wrong.