{"id":20698947,"url":"https://github.com/doomsower/react-native-startup-time","last_synced_at":"2025-04-05T18:07:50.356Z","repository":{"id":44940037,"uuid":"207370901","full_name":"doomsower/react-native-startup-time","owner":"doomsower","description":"measure startup time of your react-native app","archived":false,"fork":false,"pushed_at":"2023-08-31T22:53:03.000Z","size":452,"stargazers_count":116,"open_issues_count":4,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T17:08:27.113Z","etag":null,"topics":["benchmark","debug","measurement","optimization","profiling","react-native","startup"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doomsower.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-09T17:55:21.000Z","updated_at":"2025-02-27T13:20:16.000Z","dependencies_parsed_at":"2024-06-19T06:09:12.341Z","dependency_job_id":"2a4f8535-6f98-4c24-b42d-bce045b1d65c","html_url":"https://github.com/doomsower/react-native-startup-time","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Freact-native-startup-time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Freact-native-startup-time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Freact-native-startup-time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Freact-native-startup-time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doomsower","download_url":"https://codeload.github.com/doomsower/react-native-startup-time/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378142,"owners_count":20929296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","debug","measurement","optimization","profiling","react-native","startup"],"created_at":"2024-11-17T00:27:29.354Z","updated_at":"2025-04-05T18:07:50.336Z","avatar_url":"https://github.com/doomsower.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-startup-time\n\nThis module helps you to measure your app launch time. It is measured from the earliest point in time available to the native module, that is the module's initialization. When `getTimeSinceStartup` is called on JS side, you'll get a promise which resolves with difference between these two moments in ms. This is not very accurate, but should give you good enough base for further optimizations.\n\nOn iOS time measurement is based on [this article](https://medium.com/@michael.eisel/measuring-your-ios-apps-pre-main-time-in-the-wild-98197f3d95b4). On Android [SystemClock.uptimeMills](https://developer.android.com/reference/android/os/SystemClock.html) is used.\n\nAs far as I know, there's no way to programmatically obtain time passed since the moment when user taps on app icon. For this you have to use native dev tools. On Android this module will call `reportFullyDrawn` so you can inspect adb logs.\n\nIf you know a better way to measure startup time (in a module), let me know or better shoot a PR.\n\n## Getting started\n\n`$ yarn add react-native-startup-time`\n\n### Mostly automatic installation\n\nThis module supports autolinking so **if you use RN 0.60+ then no additional action is required**.\n\nOtherwise, run\n\n`$ react-native link react-native-startup-time`\n\n### Manual linking installation\n\n\u003cdetails\u003e\n    \u003csummary\u003eShow manual installation steps\u003c/summary\u003e\n    \n1. Open `./android/settings.gradle`, add this:\n\n```gradle\ninclude ':react-native-startup-time'\nproject(':react-native-startup-time').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-startup-time/android')\n```\n\n2. Open `./android/app/build.gradle`, add this:\n\n```gradle\nimplementation project(':react-native-startup-time')\n```\n\n3. In `MainApplication.java`, add this:\n\n```java\n// Import\nimport com.github.doomsower.RNStartupTimePackage;\n\n// Define package\nnew RNStartupTimePackage()\n```\n\u003c/details\u003e\n\n\n## Usage\n\nRender startup time badge somewhere on your first screen:\n\n```jsx\nimport { StartupTime } from 'react-native-startup-time';\n\n\u003cStartupTime\n  ready={true /* optional, defaults to true */}\n  style={styles.startupTime /* optional*/}\n/\u003e\n```\n\nOr use imperative call:\n\n```jsx\nimport { getTimeSinceStartup } from 'react-native-startup-time';\n\n// when you app is ready:\ngetTimeSinceStartup().then((time) =\u003e {\n  console.log(`Time since startup: ${time} ms`);\n});\n```\n\n_The following sections are applicable to Android only_\n\n### Single-Sampling\n\nThis makes sure Android doesn't resolve the getTimeSinceStartup promise more than once per app execution. More information in [PR #10](https://github.com/doomsower/react-native-startup-time/pull/10).\n\nSince v1.4.0 this strategy is enabled by default, if you're migrating from a previous version and you just want things to keep working as they are, follow the steps below.\n\n#### Disabling Single-Sampling:\n\nBe aware, depending on which lifecycle hook you've attached your call to `getTimeSinceStartup()` you might receive redundant invocations, e.g. when the app is brought from bg to fg. Because the app isn't really starting up, the measured time can be unrealistic; such unrealistic samples adulterate your data.\n\nTo disable single-sampling strategy, create your package using constructor with parameter `false`:\n```java\n// Define package\nnew RNStartupTimePackage(false)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoomsower%2Freact-native-startup-time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoomsower%2Freact-native-startup-time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoomsower%2Freact-native-startup-time/lists"}