Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Speeding up the build process of a monolithic a...

Speeding up the build process of a monolithic application

Working on an application used by thousands of users might be hard. The app usually consists of multiple files with the source code and even thousands or millions of lines of code - it takes ages to compile. Splitting a monolith into modules and caching the binaries can speed up the build process!

The talk was presented on the iOS Conf SG 2021 on January 21st.

Maciej Piotrowski

January 21, 2021
Tweet

More Decks by Maciej Piotrowski

Other Decks in Programming

Transcript

  1. 20 million customers each month one of top ten most

    visited e-commerce sites worldwide mobile apps big chunk of traffic The most popular product search engine in Poland
  2. 370 804 LOC 3.2 GHz 6-Core CPU 32 GB RAM

    5+ minutes on CI servers 2.2 GHz 6-Core CPU 32 GB RAM 10+ minutes on workstations compiled
  3. Swift + Objective-C (LoC) 400 000 500 000 600 000

    329 692 676 303 19 month increment (Jun 2019 - Dec 2020)
  4. Clean Build (s) 190 130 88 177 220 250 307

    12 month increment (Jun 2019 - May 2020) 238
  5. Clean Build (s) 190 130 88 177 220 250 307

    19 month increment (Jun 2019 - Dec 2020) 238
  6. Clean Build (s) 190 130 177 220 250 307 19

    month increment (Jun 2019 - Dec 2020) 238 How did we compile 78 modules in 88 s? 88
  7. How to achieve fast compile times? build & cache binaries

    of frameworks tuist.io bazel.build buck.build
  8. one more thing … goal: provide seamless developer experience BUILD

    project files bazel build //Modules/Cart multi language codebase (Swift+ObjC) undefined structure of sub-projects
  9. How to enforce same structure for new modules? modulegen tool:

    unzips a template replaces <ProjectName> integrates into workspace links as a dependency
  10. OVERVIEW: Steve provides you a convenient way to solve daily

    development problems and complete repetitive tasks. USAGE: steve <subcommand> OPTIONS: --version Show the version. -h, --help Show help information. SUBCOMMANDS: fixme Fixes most common issues that developers encounter generate Allows to generate multiple items related to Allegro app bazel Use this command to invoke bazel with parameters focus Allows you to focus on selected modules from Allegro workspace test Run tests for given project and scheme
  11. Continuous Integration A CI plan with 2 jobs fills a

    remote cache per each PR and the main branch: - job building frameworks for iOS simulator - job building frameworks for iOS device
  12. Bazel gotchas just opening Storyboard/XIBs can invalidate cache exclude .DS_STORE

    otherwise it can invalidate cache single language codebase not needed no progress bar while running Bazel by a run script in Xcode
  13. from 32 to 78 in 1 year ./steve jobs more

    small modules = faster builds 307s 88s 57s ./xcodegen generate -s project.yml
  14. allegro.tech Speeding up iOS builds with Bazel Speeding up warm

    builds in Xcode Maciej Piotrowski twitter.com/paciej00