redux-persist: Stop saving REHYDRATE payload to disk.#4373
redux-persist: Stop saving REHYDRATE payload to disk.#4373gnprice merged 1 commit intozulip:masterfrom
REHYDRATE payload to disk.#4373Conversation
This comment has been minimized.
This comment has been minimized.
149346f to
e8cc6e9
Compare
This comment has been minimized.
This comment has been minimized.
|
Here's a chart for starting up the app (on a release build on one account on CZO on my iPhone) six times: before the change, and after. Logging code: diff --git src/boot/replaceRevive.js src/boot/replaceRevive.js
index 7c1eb0e9f..91eb92949 100644
--- src/boot/replaceRevive.js
+++ src/boot/replaceRevive.js
@@ -2,6 +2,7 @@
import invariant from 'invariant';
import Immutable from 'immutable';
+import * as logging from '../utils/logging';
import { ZulipVersion } from '../utils/zulipVersion';
import { GravatarURL, UploadedAvatarURL, FallbackAvatarURL } from '../utils/avatar';
@@ -147,7 +148,10 @@ const reviver = function reviver(key, value) {
};
export const stringify = function stringify(data: mixed): string {
+ const before = Date.now();
const result = JSON.stringify(data, replacer);
+ const after = Date.now();
+ logging.logToProfiling({ durationMs: after - before, ip: '192.168.1.7' });
if (result === undefined) {
// Flow says that the output for JSON.stringify could be
// undefined. From MDN:Hmm, interesting! I see the expected result that there's just one tall bar per startup (that's the |
e8cc6e9 to
7389870
Compare
One thing is that when we've made updates across the state tree, that doesn't result in just one call to So the tall bars come from |
The expensive part of persisting the state to disk is running `stringify` (see replaceRevive.js). While zulip#4348 brought this time from almost 2000ms down to, perhaps, 300ms on one account on my device [1], that's still a long time, especially for work that doesn't need to be done. See discussion [2] for how we arrived at this solution. [1] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.60remotedev-serialize.60.20and.20.60jsan.60/near/1083700 [2] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.60remotedev-serialize.60.20and.20.60jsan.60/near/1089466
7389870 to
08b77bb
Compare
|
Thanks -- merged! I made a tiny edit to add a blank line above each of the two new comments, to separate it visually from the code above. |
Oh OK, right, that makes sense! Thanks for the review, tweak, and merge. |

The expensive part of persisting the state to disk is running
stringify(see replaceRevive.js). While #4348 brought this timefrom almost 2000ms down to, perhaps, 300ms on one account on my
device [1], that's still a long time, especially for work that
doesn't need to be done.
See discussion [2] for this solution.
[1] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.60remotedev-serialize.60.20and.20.60jsan.60/near/1083700
[2] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.60remotedev-serialize.60.20and.20.60jsan.60/near/1089466