Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: use relaxed IDB transactions and manually commit (#218)
* perf: use relaxed IDB transactions and manually commit * fix: reduce time spent in benchmark * fix: add missing txn.commit() * fix: small syntax change
- Loading branch information
1 parent
e89ed42
commit d732610
Showing
7 changed files
with
123 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
</head> | ||
<body> | ||
<script type="module" src="./benchmark.js"></script> | ||
<script type="module"> | ||
import Database from 'emoji-picker-element/database' | ||
|
||
performance.mark('initialLoad') | ||
const dataSource = '/data.json' | ||
const database = new Database({ dataSource }) | ||
await database.ready() | ||
|
||
|
||
for (let i = 0; i < 10; i++) { | ||
await database.getEmojiByUnicodeOrName('💥') | ||
await database.getEmojiBySearchQuery('boom') | ||
await database.getEmojiByShortcode('boom') | ||
await database.getEmojiByGroup(1) | ||
await database.getPreferredSkinTone() | ||
await database.getTopFavoriteEmoji(10) | ||
await database.incrementFavoriteEmojiCount('💥') | ||
await database.setPreferredSkinTone(0) | ||
} | ||
|
||
performance.measure('initialLoad', 'initialLoad') | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/Polymer/tachometer/master/config.schema.json", | ||
"sampleSize": 50, | ||
"timeout": 5, | ||
"horizons": ["10%"], | ||
"benchmarks": [ | ||
{ | ||
"url": "./database-interactions.html", | ||
"browser": { | ||
"name": "chrome", | ||
"headless": true | ||
}, | ||
"measurement": [ | ||
{ | ||
"mode": "performance", | ||
"entryName": "benchmark-total" | ||
} | ||
], | ||
"expand": [ | ||
{ | ||
"name": "this-change" | ||
}, | ||
{ | ||
"name": "tip-of-tree", | ||
"packageVersions": { | ||
"label": "tip-of-tree", | ||
"dependencies": { | ||
"emoji-picker-element": { | ||
"kind": "git", | ||
"repo": "https://github.com/nolanlawson/emoji-picker-element.git", | ||
"ref": "master", | ||
"setupCommands": [ | ||
"yarn --immutable --ignore-scripts", | ||
"PERF=1 yarn build:rollup" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |