Baemin WebView: Implementation Strategy That Improved LCP by 37% with Inline Scripts

Woowa BrothersWoowa Brothers·Original
Operator Bae ChangHyun

Key point

Baemin reduced WebView LCP from 1,340ms to 847ms with inline scripts on a Galaxy S22+ over Wi-Fi.

1 / 11

Details

  • To change the loading waterfall in Baemin’s WebView, a strategy using the critical-script bundler plugin starts API requests during HTML parsing and parallelizes them with JavaScript bundle downloads and execution
  • LCP dropped from 1,340ms to 847ms in a Galaxy S22+ Wi-Fi environment, a 37% improvement
  • In one-week periods before and after the change, real-user p50, p75, and p90 LCP improved by 25–35% on the store home and product detail pages; results were aggregated for the device with the most users
  • In a 2021 Vodafone A/B test, pages with a 31% LCP improvement saw revenue increase by about 8% and the add-to-cart rate increase by 11%

Implementation

  • Place a *.critical.ts file alongside the page, load it with ?as-critical-script, and insert it into the HTML as an inline script
  • The Vite plugin bundles and minifies the code with esbuild, and the build fails if the size exceeds the default limit of 8KB; the limit was initially set to 4KB and later raised
  • Since the inline script runs in a separate runtime, it does not share libraries or polyfills with the main app; responses are passed through a window global cache and converted to the required format using an adapter when needed

Use Cases and Limitations

  • Used on about 80 pages to start API requests earlier and preload LCP images using image URLs included in API responses
  • Improve FCP by getting device insets from the app bridge first so skeletons can be shown earlier, or by using product images from URL query parameters to compose the first screen of a product detail page
  • Since this approach parallelizes loading steps rather than reducing CPU processing time or network time itself, its impact may be limited depending on the circumstances

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.