diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index c7b79f9..fd83dbc 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -45,10 +45,9 @@ jobs: # first-load - name: Benchmark first-load run: | - cd test/benchmark - ../../node_modules/.bin/tach \ - --config ./first-load.tachometer.json \ - --json-file ./first-load.results.json + ./node_modules/.bin/tach \ + --config ./test/benchmark/first-load.tachometer.json \ + --json-file ./test/benchmark/first-load.results.json - name: Report first-load uses: andrewiggins/tachometer-reporter-action@v2 @@ -61,10 +60,9 @@ jobs: # second-load - name: Benchmark second-load run: | - cd test/benchmark - ../../node_modules/.bin/tach \ - --config ./second-load.tachometer.json \ - --json-file ./second-load.results.json + ./node_modules/.bin/tach \ + --config ./test/benchmark/second-load.tachometer.json \ + --json-file ./test/benchmark/second-load.results.json - name: Report second-load uses: andrewiggins/tachometer-reporter-action@v2 @@ -77,10 +75,9 @@ jobs: # database-interactions - name: Benchmark database-interactions run: | - cd test/benchmark - ../../node_modules/.bin/tach \ - --config ./database-interactions.tachometer.json \ - --json-file ./database-interactions.results.json + ./node_modules/.bin/tach \ + --config ./test/benchmark/database-interactions.tachometer.json \ + --json-file ./test/benchmark/database-interactions.results.json - name: Report database-interactions uses: andrewiggins/tachometer-reporter-action@v2 diff --git a/.gitignore b/.gitignore index 8c69db7..8db50d3 100644 --- a/.gitignore +++ b/.gitignore @@ -131,4 +131,5 @@ dist /bundle.js /test/benchmark/node_modules /test/benchmark/data.json -/i18n \ No newline at end of file +/test/benchmark/*.js +/i18n diff --git a/bin/run-benchmark.sh b/bin/run-benchmark.sh deleted file mode 100755 index bbf8259..0000000 --- a/bin/run-benchmark.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -e - -./bin/setup-benchmark.sh - -cd ./test/benchmark - -../../node_modules/.bin/tach --config ./first-load.tachometer.json -../../node_modules/.bin/tach --config ./second-load.tachometer.json - diff --git a/bin/setup-benchmark.sh b/bin/setup-benchmark.sh index 97b6933..97e9cb1 100755 --- a/bin/setup-benchmark.sh +++ b/bin/setup-benchmark.sh @@ -4,11 +4,11 @@ set -e cd ./test/benchmark -# fix Tachometer not finding the local dependency using a symlink hack -rm -fr ./node_modules -mkdir ./node_modules -ln -s ../../.. ./node_modules/emoji-picker-element +# Tachometer doesn't seem to be able to locate relative files anywhere but the currect directory. So +# move every file we need right here. +# See also: https://github.com/google/tachometer/issues/244 +ln -sf ../../node_modules/emoji-picker-element-data/en/emojibase/data.json ./data.json -# have Tachometer host the data.json right here -rm -f ./data.json -ln -s ../../node_modules/emoji-picker-element-data/en/emojibase/data.json ./data.json \ No newline at end of file +for file in index.js picker.js database.js; do + ln -sf "../../$file" "$file" +done diff --git a/package.json b/package.json index 56d650c..5c76291 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,11 @@ "build:i18n-docs": "node ./bin/generateI18nDocs", "build:toc": "node ./bin/generateTOC", "build:i18n": "node ./bin/buildI18n", - "benchmark:runtime": "cross-env PERF=1 run-s build:rollup && ./bin/run-benchmark.sh", + "benchmark:runtime": "cross-env PERF=1 run-s build:rollup benchmark:runtime:setup benchmark:runtime:firstload benchmark:runtime:secondload benchmark:runtime:database", + "benchmark:runtime:setup": "./bin/setup-benchmark.sh", + "benchmark:runtime:firstload": "tach --config ./test/benchmark/first-load.tachometer.json", + "benchmark:runtime:secondload": "tach --config ./test/benchmark/second-load.tachometer.json", + "benchmark:runtime:database": "tach --config ./test/benchmark/database-interactions.tachometer.json", "benchmark:bundlesize": "run-s build:rollup benchmark:bundle benchmark:run-bundlesize", "benchmark:bundle": "rollup -c ./test/bundlesize/rollup.config.js", "benchmark:memory": "run-s build:rollup benchmark:bundle && run-p --race benchmark:memory:server benchmark:memory:test", @@ -69,9 +73,6 @@ "url": "https://github.com/nolanlawson/emoji-picker-element/issues" }, "homepage": "https://github.com/nolanlawson/emoji-picker-element#readme", - "//": { - "tachometer": "cannot upgrade to 0.6.0 due to https://github.com/google/tachometer/issues/244" - }, "devDependencies": { "@babel/preset-env": "^7.16.11", "@peculiar/webcrypto": "^1.4.1", @@ -127,7 +128,7 @@ "svelte-jester": "^2.3.2", "svelte-preprocess": "^4.10.3", "svgo": "^2.8.0", - "tachometer": "0.5.10", + "tachometer": "^0.7.0", "terser": "^5.12.1" }, "standard": { diff --git a/test/benchmark/database-interactions.html b/test/benchmark/database-interactions.html index c176051..4debdf0 100644 --- a/test/benchmark/database-interactions.html +++ b/test/benchmark/database-interactions.html @@ -6,10 +6,10 @@ diff --git a/test/benchmark/first-load.tachometer.json b/test/benchmark/first-load.tachometer.json index 5d2173c..3f1d868 100644 --- a/test/benchmark/first-load.tachometer.json +++ b/test/benchmark/first-load.tachometer.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/Polymer/tachometer/master/config.schema.json", "sampleSize": 50, "timeout": 5, - "horizons": ["10%"], + "autoSampleConditions": ["10%"], "benchmarks": [ { "url": "./first-load.html", diff --git a/test/benchmark/package.json b/test/benchmark/package.json deleted file mode 100644 index 43c4df4..0000000 --- a/test/benchmark/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "emoji-picker-element-benchmark", - "private": true, - "version": "0.0.1", - "dependencies": { - "emoji-picker-element": "*" - } -} \ No newline at end of file diff --git a/test/benchmark/second-load.html b/test/benchmark/second-load.html index abfa826..be4d327 100644 --- a/test/benchmark/second-load.html +++ b/test/benchmark/second-load.html @@ -6,10 +6,10 @@