Comments (3)
I wrote some performance tests, available at https://gist.github.com/gervasiocaj/b8c326f01cbcddad2a9f9cc8b080c823.
The sample data is structured in the following format: http://www.filltext.com/?rows=2&id={string|8}&username={username}&password={string|5}&text={lorem|30}&pretty=true
// myData format:
// [{ "id": "04Kwnn2Q", "username": "DChandrasekahran", ... }]
// myDataAsObject format:
// { "04Kwnn2Q": { "username": "DChandrasekahran", ... } }
// myDataIds format:
// [ "04Kwnn2Q" ]
The code run was the following:
const storageGet = data => new Promise(resolve => chrome.storage.local.get(data, resolve))
const storageSet = data => new Promise(resolve => chrome.storage.local.set(data, resolve))
console.time('storageSet test all data')
await storageSet({ data: myData })
console.timeEnd('storageSet test all data')
console.time('storageGet test all data')
await storageGet('data')
console.timeEnd('storageGet test all data')
// -----------------------------------------
console.time('storageSet test each data')
await storageSet(myDataAsObject)
console.timeEnd('storageSet test each data')
console.time('storageGet test each data')
await storageGet(myDataIds)
console.timeEnd('storageGet test each data')
The dataset length for the following results is 1000.
storageSet test all data: 70.7080078125ms
storageGet test all data: 28.281005859375ms
storageSet test each data: 62.2861328125ms
storageGet test each data: 24.7099609375ms
I am open to suggestions for broader tests, if needed.
from trakttvstats.
Can't find performance tests about chrome.storage.local.get
, so tests may be needed to determine the best method between those two possibilities :
- Store every cached responses in one large object and retrieve everything once (current)
- Store each cached json response separately and retrieve those needed with individual
chrome.storage.local.get
calls.
from trakttvstats.
Amazing !
So there is a measurable performance hit, but very small, between getting everything and picking some. If timings increase is moderate with a huge cache object (10.000, 100.000 ?), it would confirm that it's largely preferable to load everything once.
What was the ids count of myDataIds
?
from trakttvstats.
Related Issues (20)
- Add synopsis layout and localization options HOT 2
- Save options changes without a save button
- More options for posters localization HOT 1
- UI v3 HOT 1
- Update Readme and images for v0.4
- Add readability improvement of years on fanarts
- Code cleaning
- Add localization of every dates
- Improved items translation behavior, removal of translation mode option
- Localization : Support tv episodes
- Firefox support
- wrong matching on some translated posters HOT 3
- Custom external links improvement for shows and episodes HOT 5
- Country codes using the additional ISO-3166-1 should not be saved as lowercase
- Extensions settings checkbox not rendering their states
- External links don't work properly for some medias with special characters such as "&"
- Did this amazing extension finally die? HOT 11
- 0.5 layout update : posters filtering HOT 5
- statistics are not working, blank date release
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trakttvstats.