Skip to content

Commit

Permalink
Handle page size changes, use one worker per file, and more benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
jlongster committed Aug 7, 2021
1 parent 41cf140 commit dcbd246
Show file tree
Hide file tree
Showing 23 changed files with 995 additions and 482 deletions.
9 changes: 7 additions & 2 deletions dist/indexeddb-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,8 @@ function startWorker(reader, writer) {
reader.done();
break;

case '__perf-deets:end-profile':
writer.string('profile-end');
case '__perf-deets:stop-profile':
writer.string('profile-stop');
writer.finalize();
reader.int32();
reader.done();
Expand Down Expand Up @@ -834,6 +834,11 @@ class IndexedDBBackend {
return new File(filename, this.defaultBlockSize, new FileOps(filename));
}

shutdown() {
writer.string('shutdown');
writer.finalize();
}

// Instead of controlling the profiler from the main thread by
// posting a message to this worker, you can control it inside the
// worker manually with these methods
Expand Down

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions dist/indexeddb-main-thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,10 @@ function makeStartWorkerFromMain(getModule) {
};
}

let hasInitialized = false;

function makeInitBackend(spawnEventName, getModule) {
const startWorkerFromMain = makeStartWorkerFromMain(getModule);

return worker => {
if (hasInitialized) {
return;
}
hasInitialized = true;

worker.addEventListener('message', e => {
switch (e.data.type) {
case spawnEventName:
Expand All @@ -69,7 +62,7 @@ function makeInitBackend(spawnEventName, getModule) {
// Use the generic main thread module to create our indexeddb worker
// proxy
const initBackend = makeInitBackend('__absurd:spawn-idb-worker', () =>
import('./indexeddb-main-thread-worker-662a7d64.js')
import('./indexeddb-main-thread-worker-e59518b4.js')
);

export { initBackend };
9 changes: 7 additions & 2 deletions dist/perf/indexeddb-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,8 @@ function startWorker(reader, writer) {
reader.done();
break;

case '__perf-deets:end-profile':
writer.string('profile-end');
case '__perf-deets:stop-profile':
writer.string('profile-stop');
writer.finalize();
reader.int32();
reader.done();
Expand Down Expand Up @@ -840,6 +840,11 @@ class IndexedDBBackend {
return new File(filename, this.defaultBlockSize, new FileOps(filename));
}

shutdown() {
writer.string('shutdown');
writer.finalize();
}

// Instead of controlling the profiler from the main thread by
// posting a message to this worker, you can control it inside the
// worker manually with these methods
Expand Down
34 changes: 0 additions & 34 deletions dist/perf/indexeddb-main-thread-worker-8819e539.js

This file was deleted.

Loading

0 comments on commit dcbd246

Please sign in to comment.