Skip to content

Commit

Permalink
Merge branch 'master' into compat-default-value
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister authored Jan 26, 2021
2 parents 41636ef + 5044515 commit e0842e8
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 45 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ jobs:
with:
name: build-output
path: preact.tgz
- name: Initialize Tachometer Results Report
uses: andrewiggins/tachometer-reporter-action@v2
with:
initialize: true

bench_text_update:
name: Bench text_update
Expand Down Expand Up @@ -257,26 +253,3 @@ jobs:
with:
name: results
path: benches/results/filter_list.json

report_results:
name: Report Results
runs-on: ubuntu-latest
needs:
- bench_text_update
- bench_many_updates
- bench_02_replace1k
- bench_03_update10th1k_x16
- bench_07_create10k
- bench_hydrate1k
- bench_filter_list
steps:
- uses: actions/download-artifact@v2
with:
name: results
path: results
- uses: andrewiggins/tachometer-reporter-action@v2
with:
path: results/*.json
base-bench-name: preact-master
pr-bench-name: preact-local
summarize: 'duration, usedJSHeapSize'
51 changes: 51 additions & 0 deletions .github/workflows/pr-reporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Report Results to PR

on:
# The pull_request event can't write comments for PRs from forks so using this
# workflow_run workflow as a workaround
workflow_run:
workflows: ['Benchmarks']
branches: ['**']
types:
- completed
- requested

jobs:
report_running:
name: Report benchmarks are in-progress
runs-on: ubuntu-latest
# Only add the "benchmarks are running" text when a workflow_run is
# requested (a.k.a starting)
if: ${{ github.event.action == 'requested' }}
steps:
- name: Report Tachometer Running
uses: andrewiggins/tachometer-reporter-action@v2
with:
# Set initialize to true so this action just creates the comment or
# adds the "benchmarks are running" text
initialize: true

report_results:
name: Report benchmark results
runs-on: ubuntu-latest
# Only run this job if the event action was "completed" and the triggering
# workflow_run was successful
if: ${{ github.event.action == 'completed' && github.event.workflow_run.conclusion == 'success' }}
steps:
# Download the artifact from the triggering workflow that contains the
# Tachometer results to report
- uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow.id }}
run_id: ${{ github.event.workflow_run.id }}
name: results
path: results

# Create/update the comment with the latest results
- name: Report Tachometer Results
uses: andrewiggins/tachometer-reporter-action@v2
with:
path: results/*.json
base-bench-name: preact-master
pr-bench-name: preact-local
summarize: 'duration, usedJSHeapSize'
12 changes: 7 additions & 5 deletions .github/workflows/main.yml → .github/workflows/size.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Compressed Size

on: [pull_request]
on:
pull_request:
branches:
- '**'
paths:
- '**/src/**.js'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2-beta
with:
fetch-depth: 1
- uses: actions/checkout@v2
- uses: preactjs/compressed-size-action@v1
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
21 changes: 8 additions & 13 deletions src/diff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,30 +300,25 @@ function diffElementNodes(
commitQueue,
isHydrating
) {
let i;
let oldProps = oldVNode.props;
let newProps = newVNode.props;
let nodeType = newVNode.type;
let i = 0;

// Tracks entering and exiting SVG namespace when descending through the tree.
if (nodeType === 'svg') isSvg = true;

if (excessDomChildren != null) {
for (i = 0; i < excessDomChildren.length; i++) {
for (; i < excessDomChildren.length; i++) {
const child = excessDomChildren[i];

// if newVNode matches an element in excessDomChildren or the `dom`
// argument matches an element in excessDomChildren, remove it from
// excessDomChildren so it isn't later removed in diffChildren
//
// Note: This takes advantage of Text nodes having `.localName=undefined`,
// which is loosely equal to Text VNodes' `.type=null`. Elements use string equality.
if (
child != null &&
((nodeType === null
? child.nodeType === 3
: child.localName === nodeType) ||
dom == child)
child &&
(child === dom ||
(nodeType ? child.localName == nodeType : child.nodeType == 3))
) {
dom = child;
excessDomChildren[i] = null;
Expand Down Expand Up @@ -364,9 +359,9 @@ function diffElementNodes(
dom.data = newProps;
}
} else {
if (excessDomChildren != null) {
excessDomChildren = EMPTY_ARR.slice.call(dom.childNodes);
}
// If excessDomChildren was not null, repopulate it with the current element's children:
excessDomChildren =
excessDomChildren && EMPTY_ARR.slice.call(dom.childNodes);

oldProps = oldVNode.props || EMPTY_OBJ;

Expand Down

0 comments on commit e0842e8

Please sign in to comment.