Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc perf improvements #1535

Merged
merged 14 commits into from Mar 30, 2020
Merged

Misc perf improvements #1535

merged 14 commits into from Mar 30, 2020

Conversation

DylanPiercey
Copy link
Contributor

Description

Many of these performance improvements are targeted toward legacy components, however some also improve modern components.

Legacy widget improvements include:

  • Serializing legacy body content & widgetConfig now use less bytes.
  • Legacy components no longer necessarily serialize an empty object for component props (this is now skipped for legacy components)
  • Legacy components no longer serialize null for input, instead use 0.

Modern component improvements include:

  • Places where a nonce is added to scripts now uses the optimized double quote escape instead of JSON.stringify.
  • Simplified key sequence code and use null prototype objects where possible.
  • Server component simplified to use noops for missing lifecycle methods.
  • Dynamic tag can now better tell apart user keys from auto keys which reduces the number of data-marko-key attributes output for split components.
  • Dynamic tag runtime optimized into a few more specialized functions and other micro optimizations.
  • HTML attribute helper now optimized for the common case of dealing with strings.
  • HTML attribute helper will now assume strings that start with { are JSON, and use single quotes.
  • Double & Single quote escape helpers now use a different implementation than the escape body content and no longer escape &.
  • Attribute name validity cache on the server side now uses a Set.

Checklist:

  • I have read the CONTRIBUTING document and have signed (or will sign) the CLA.
  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

@codecov
Copy link

codecov bot commented Mar 27, 2020

Codecov Report

Merging #1535 into master will increase coverage by 0.00%.
The diff coverage is 96.45%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1535   +/-   ##
=======================================
  Coverage   90.51%   90.52%           
=======================================
  Files         352      353    +1     
  Lines       12645    12657   +12     
=======================================
+ Hits        11446    11458   +12     
  Misses       1199     1199           
Impacted Files Coverage Δ
packages/marko/src/runtime/components/Component.js 95.86% <ø> (-0.02%) ⬇️
.../src/runtime/components/GlobalComponentsContext.js 100.00% <ø> (ø)
...o/src/runtime/components/legacy/renderer-legacy.js 97.00% <ø> (ø)
packages/marko/src/runtime/helpers/_weak-map.js 42.85% <42.85%> (ø)
packages/marko/src/runtime/html/helpers/attr.js 96.00% <95.00%> (-4.00%) ⬇️
...rc/compiler/ast/HtmlAttribute/html/generateCode.js 91.30% <100.00%> (ø)
...kages/marko/src/runtime/components/ComponentDef.js 98.61% <100.00%> (+0.03%) ⬆️
...ckages/marko/src/runtime/components/KeySequence.js 100.00% <100.00%> (ø)
...es/marko/src/runtime/components/ServerComponent.js 63.33% <100.00%> (-7.72%) ⬇️
packages/marko/src/runtime/components/dom-data.js 100.00% <100.00%> (+50.00%) ⬆️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3850f1...55f7745. Read the comment docs.

@mlrawlings mlrawlings merged commit ff82248 into master Mar 30, 2020
@DylanPiercey DylanPiercey deleted the misc-perf-improvements branch April 10, 2020 19:55
DylanPiercey added a commit that referenced this pull request Apr 13, 2020
* perf: attr & escape helper optimization

* perf: optimize server component

* perf: dynamic tag perf improvements

* perf: prevent escaping json attrs, optimize nonce

* perf: legacy widget & dynamic tag key serialization improvement

* perf: prevent serializing component props for legacy components

* fix: auto key regexp for dynamic tag

* perf: prevent creating constructors for implicit components

(cherry picked from commit ff82248)
DylanPiercey added a commit that referenced this pull request Apr 13, 2020
* perf: attr & escape helper optimization

* perf: optimize server component

* perf: dynamic tag perf improvements

* perf: prevent escaping json attrs, optimize nonce

* perf: legacy widget & dynamic tag key serialization improvement

* perf: prevent serializing component props for legacy components

* fix: auto key regexp for dynamic tag

* perf: prevent creating constructors for implicit components

(cherry picked from commit ff82248)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants