Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Improve loading times for list views #907

Open
kosecki123 opened this issue Dec 11, 2018 · 0 comments
Open

[Feature] Improve loading times for list views #907

kosecki123 opened this issue Dec 11, 2018 · 0 comments
Assignees

Comments

@kosecki123
Copy link
Contributor

Couple ideas on how to improve loading times:

  1. Show the cache content and do not wait for the sync

When there is any data for given period

async getTransactions(
{ startBlock = this.requestFactoryStartBlock, endBlock = 'latest' },
cache = this.cacheDefault,
onlyAddresses = false
) {
if (this.running && (cache || endBlock == 'latest')) {
if (this.allTransactionsAddresses.length > 0) {
return onlyAddresses ? this.allTransactionsAddresses : this._cache.transactions;
}
if (this.syncing) {
await this.awaitSync();
return onlyAddresses ? this.allTransactionsAddresses : this._cache.transactions;
}
}

This will end up with much better UX as returning users will get the data immediatelly.

  1. Decouple slow operations from fast

Showing transactions from the bucket is fast, while reading for events in order to see the status is slow. When showing transaction list, display transactions from the bucket first and then load the statuses (use some loader animation instead of value, or show known value + loader)

  1. Improve cache speed

Avoid heavy serialization/deserialization and writes

addRequestCreatedLogToCache(log) {
const logs = this._storage.load(REQUEST_LOGS_CACHE_KEY);
let newLogs;
if (logs) {
newLogs = JSON.parse(logs);
const exists = newLogs.find(cachedLog => cachedLog.args.request === log.args.request);
if (!exists) {
newLogs.push(log);
}
} else {
newLogs = [log];
}
this._storage.save(REQUEST_LOGS_CACHE_KEY, JSON.stringify(newLogs));
this._storage.save(REQUEST_LOGS_END_BLOCK_CACHE_KEY, log.blockNumber);
this.loadRequestCreatedLogsFromStorage();
}

Should take advantage of insert/update of indexedDb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants