Skip to content

Commit

Permalink
different results
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Sep 2, 2022
1 parent 94eed5c commit 87013a6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion benches/scripts/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const defaultBenchOptions = {
// GitHub Action minutes
timeout: 1,
'window-size': '1024,768',
framework: IS_CI ? ['preact-master', 'preact-local'] : null,
framework: IS_CI ? ['preact-master', 'preact-local', 'preact-hooks'] : null,
trace: false
};

Expand Down
9 changes: 0 additions & 9 deletions benches/scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ async function validateFileDep(framework) {
* @type {BenchConfig[]}
*/
export const frameworks = [
{
label: 'preact-v8',
dependencies: {
framework: 'file:' + repoRoot('benches/proxy-packages/preact-v8-proxy')
},
isValid() {
return validateFileDep(this.dependencies.framework);
}
},
{
label: 'preact-master',
dependencies: {
Expand Down
32 changes: 32 additions & 0 deletions benches/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,35 @@ export function testElementTextContains(selector, expectedText) {
);
}
}

let count = 0;
const channel = new MessageChannel();
const callbacks = new Map();
channel.port1.onmessage = e => {
let id = e.data;
let fn = callbacks.get(id);
callbacks.delete(id);
fn();
};
let pm = function(callback) {
let id = ++count;
callbacks.set(id, callback);
this.postMessage(id);
}.bind(channel.port2);

export function nextTick() {
return new Promise(r => pm(r));
}

export function mutateAndLayoutAsync(mutation, times = 1) {
return new Promise(resolve => {
requestAnimationFrame(() => {
for (let i = 0; i < times; i++) {
mutation(i);
}
pm(resolve);
});
});
}

export const sleep = ms => new Promise(r => setTimeout(r, ms));

0 comments on commit 87013a6

Please sign in to comment.