# Moving Local Storage to Jetpack DataStore Without Paying a Cent in Performance

DevFeed: [Moving Local Storage to Jetpack DataStore Without Paying a Cent in Performance](<https://devfeed.tech/articles/moving-local-storage-to-jetpack-datastore-without-paying-a-cent-in-performance-84567.md>)

Original publisher: [Read original article](<https://proandroiddev.com/moving-local-storage-to-jetpack-datastore-without-paying-a-cent-in-performance-e709b28719de?source=rss----c72404660798---4>)

Author: Taufik Amaryansyah

Published: 2026-10-10T17:14:49Z

Content type: article

Language: en

Sources: [ProAndroidDev](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [Jetpack](<https://devfeed.tech/topics/jetpack.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [scheduling](<https://devfeed.tech/topics/scheduling.md>), [async](<https://devfeed.tech/topics/async.md>), [coroutines-flow](<https://devfeed.tech/topics/coroutines-flow.md>)

Tags: [2](<https://devfeed.tech/tags/2.md>), [3](<https://devfeed.tech/tags/3.md>), [all](<https://devfeed.tech/tags/all.md>), [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [anr](<https://devfeed.tech/tags/anr.md>), [api](<https://devfeed.tech/tags/api.md>), [app](<https://devfeed.tech/tags/app.md>), [apply](<https://devfeed.tech/tags/apply.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [background](<https://devfeed.tech/tags/background.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [blocks](<https://devfeed.tech/tags/blocks.md>), [but](<https://devfeed.tech/tags/but.md>), [can](<https://devfeed.tech/tags/can.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-datastore](<https://devfeed.tech/tags/jetpack-datastore.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [local](<https://devfeed.tech/tags/local.md>), [mobile-performance](<https://devfeed.tech/tags/mobile-performance.md>), [moving](<https://devfeed.tech/tags/moving.md>), [performance](<https://devfeed.tech/tags/performance.md>), [storage](<https://devfeed.tech/tags/storage.md>)

## AI overview

The app replaced SharedPreferences with Jetpack DataStore and found no measurable runtime cost in an isolated comparison: startup, CPU, and memory differences stayed within run-to-run variation. On a Samsung Galaxy A15, all measured cold and warm starts after updating were faster, including the first launch that ran the migration; because the APKs differed in other ways, this shows the migration did not delay users, not that DataStore caused the speedup. The migration runs on a background thread and reportedly takes tens of milliseconds. The release as a whole showed its first screen 0.7 seconds faster on a Samsung Galaxy A55. The authors stress measuring builds in one session, reporting ranges, and adding telemetry for migration duration and write failures. Findings come from internal tests on physical devices and may vary on other hardware.

## Source excerpt

How we replaced the storage foundation of a large-scale app, then proved it with numbers.Illustration Generated by GeminiTL;DR The most important local data in our app now lives in Jetpack DataStore, replacing SharedPreferences. We measured the impact with an isolated benchmark: no measurable runtime cost. Cold start, hot start, CPU, and memory all stay within normal run-to-run variation. Migrating existing users' data to DataStore runs once and finishes in tens of milliseconds, on a background thread. In the same release, the app as a whole shows its first screen 0.7 seconds faster than the previous release on a Samsung Galaxy A55. DataStore did not stand in the way of that. Why we left SharedPreferences SharedPreferences has been part of Android since API 1. It is simple and good enough for many cases. But in an app as large as ours, its limits started to show. 1. The API is synchronous, and it is often called from the main thread. The first read of a SharedPreferences file blocks the calling thread until the whole file is loaded from disk. If that thread is the main thread, the UI waits too. 2. apply() is not fully asynchronous. apply() looks like a background write. But Android waits for every pending apply() to finish when an Activity stops or a Service finishes. On a device with slow storage, that wait can turn into an ANR. commit() is worse, because it blocks explicitly. 3. Write failures are invisible. apply() never tells you whether the data was actually saved. If it fails, the app never finds out. 4. There is no convenient reactive way to observe changes. All you get is a listener, which leaks easily and does not fit with coroutines or Flow. 5. Types are not enforced. Storing an Int and reading it back as a Long only surfaces at runtime, as a ClassCastException. Jetpack DataStore was designed to address all of this: SharedPreferences vs Jetpack DataStoreBenchmark results The question we heard most before the release: "If the storage moves to DataStore, won