Title: Removal of Snapshots support from NS 7.x · Issue #8926 · NativeScript/NativeScript · GitHub
Open Graph Title: Removal of Snapshots support from NS 7.x · Issue #8926 · NativeScript/NativeScript
X Title: Removal of Snapshots support from NS 7.x · Issue #8926 · NativeScript/NativeScript
Description: Reason why we are removing... Reasons for removal: High Support cost (> 800 issues) High dev costs (breaks frequently, OS changes like Mac requires Docker, Arm64 mac... etc) Bugs with Snapshots (snapshots are imperfect; they normally wor...
Open Graph Description: Reason why we are removing... Reasons for removal: High Support cost (> 800 issues) High dev costs (breaks frequently, OS changes like Mac requires Docker, Arm64 mac... etc) Bugs with Snapshots (sn...
X Description: Reason why we are removing... Reasons for removal: High Support cost (> 800 issues) High dev costs (breaks frequently, OS changes like Mac requires Docker, Arm64 mac... etc) Bugs with Snapshots ...
Opengraph URL: https://github.com/NativeScript/NativeScript/issues/8926
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Removal of Snapshots support from NS 7.x","articleBody":"Reason why we are removing... \r\n\r\nReasons for removal:\r\n- High Support cost (> 800 issues)\r\n- High dev costs (breaks frequently, OS changes like Mac requires Docker, Arm64 mac... etc)\r\n- Bugs with Snapshots (snapshots are imperfect; they normally work -- but occasionally we have seen issues)\r\n- Having to create additional wrappers to keep native code from being snapshotted; snapshots have to be pure JS. Meaning plugins can easily break your snapshots, and we are constrained on how to write certain pieces of code.\r\n- Inflates app distribution size \r\n- Inflates app on device size\r\n- Android Only\r\n- On modern devices, snapshots are actually **slower** than having no snapshots.\r\n- Snapshots are not optimizable. Meaning all running code from inside a snapshot cannot take advantage of many v8 optimization features while running, so their is a constant runtime performance hit. \r\n\r\n\r\nReplaced with Code Cache\r\n- Built into the v8 engine (supported by v8 maintainers), no additional support costs to us at all.\r\n- Faster than Snapshots in every instance except the very first boot. Very first boot, is slower because it has to build the cache.\r\n- Faster than Snapshots on Slower devices by a wide %.\r\n- Supported on both iOS and Android\r\n- Code-Cache built is native to the device, app space used is considerably less than w/ snapshots\r\n- Not inflating apk/ipk with snapshots for the the different platforms.\r\n- No runtime speed hit, all code is fully optimizable by v8\r\n\r\n\r\n\r\nActual Raw Numbers: (Lots of numbers)\r\nI used the NS Grocery App under NS 6, because it has multiple screens, and uses Angular and of course snapshots work. I built all apps as tns --release. I did NOT uglify nor do --env.production as the idea was to create the slowest possible app with the most JS code easily. :grinning:\r\n\r\nSo I have a couple different sets of numbers\r\n\r\nApp Sizes\r\n---\r\n\r\nStock App (no code cache, no snapshots just the app as is)\r\nAPK Size: 22.2m - Install Size: 7.5m\r\n\r\nCode Cache App\r\nAPK Size: 22.2m - Install Size: 10m (after code cache is built)\r\n\r\nSnapshot App\r\nAPK Size: 28.4m - Install Size: 21m\r\n\r\nAs you can see; not only is the APK w/ snapshots is 27% larger and on disk it actually is way over 200% larger than code cache and almost 300% larger than stock.\r\n\r\n\r\nTime to JS Executed in Milliseconds (on real devices):\r\n---\r\n`Fast` number is on a very fast modern android device (Samsung S9, Android 10), `Slow` number is very old slow device (Samsung A3, Android 5.0.2) -- All numbers were averaged, took between 5 to 12 samples depending on the variation seen in the numbers).\r\n\r\n| Type | First JS Fast | First JS Slow | Complete JS Fast | Complete JS Slow |\r\n| ----- | --------------- | ---------------- | ----------------------- | ------------------------- |\r\n| Stock Application | 467 | 1646 | 835 | 3194 |\r\n| Code Cache First Only | 695 | 2152 | 1100 | 3726 |\r\n| Code Cache All Boots (except first) | 298 | 924 | 673 | 2392 |\r\n| Snapshots | 487 | 1310 | 970 | 2980 |\r\n\r\n\r\nNote: Using Code Cache with Snapshot is even slower than either; because first startup you still have to build the cache & each startup after you have to load in TWO files, the snapshot and the cache; which kills your startup performance.\r\n\r\nExplaining the Numbers:\r\n---\r\n**First JS** means the time for the engine to startup and the point where snapshots / caches have loaded -- this is before anything has loaded, basically the very first line of JS executed.\r\n\r\n**Complete JS** means that the JS has parsed, caches/snapshots have parsed and the app is actually running -- this is when we actually hit the login screen. (So this is probably the more important number to consider as it is what your clients will think as the speed of your app.)\r\n\r\nSo on a fast device, the stock app will get to the login screen in 835ms, and on a very slow device 3194ms (or 3.194sec).\r\n\r\nA couple interesting things, on a reasonably modern fast device, using snapshots are actually > 16% SLOWER than no snapshots. However on a slow device the speed difference is around 7% faster. \r\n\r\nWith Code Cache there is a **performance hit for the very first time** your app runs. As you can see even on a fast device the hit is 265ms slower (31%) on the first boot than the stock app. However, every app start after that the speed is 20% faster. On a slow device this hit is about 16% but again on all the rest of the startups, the speed up is 33% faster than the stock...\r\n\r\n---\r\n\r\nTo us at the TSC, it does not make any sense to continue maintaining complex tooling that as you can see it considerably slower than code cache in all areas except a single app start.\r\n\r\n---\r\nTo enable code cache in NS 6 (Android only):\r\n\r\nEdit the main app/package.json and add the key \r\n`\"codeCache\": \"true\"`\r\nto the android key. like so:\r\n\r\n\r\nTo enable code cache in NS 7 (Android and iOS)\r\nEdit your main nativescript.config.ts file, and add \r\n`\"codeCache\": \"true\"` to the `android` and/or `ios` sections.\r\n\r\n\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/NathanaelA","@type":"Person","name":"NathanaelA"},"datePublished":"2020-10-02T04:30:54Z","url":"https://github.com/NativeScript/NativeScript/issues/8926"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0933652e-de75-d50b-94ab-178aac6bb9fa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8EDE:395430:165B639:1D7E8B8:6B012EF7 |
| html-safe-nonce | 83d75d790e0cbc73b66f03d1cfeb5ade51b86adbcd5a1c4c9474bba788c534bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RURFOjM5NTQzMDoxNjVCNjM5OjFEN0U4Qjg6NkIwMTJFRjciLCJ2aXNpdG9yX2lkIjoiMzgyODIxNzYwNjcxMjY2Nzg5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3797b78a9ff0d9384c7cf6be81b4d051c6bf76192944756a1d7736af302751d2 |
| hovercard-subject-tag | issue:713337902 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/8926/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d6216814613e8f3345bb63b086d62f504edd7aecce6024896e3cb02259dfd888/NativeScript/NativeScript/issues/8926 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d6216814613e8f3345bb63b086d62f504edd7aecce6024896e3cb02259dfd888/NativeScript/NativeScript/issues/8926 |
| og:image:alt | Reason why we are removing... Reasons for removal: High Support cost (> 800 issues) High dev costs (breaks frequently, OS changes like Mac requires Docker, Arm64 mac... etc) Bugs with Snapshots (sn... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NathanaelA |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 31492490 |
| octolytics-dimension-repository_nwo | NativeScript/NativeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31492490 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/NativeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width