<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Saumye Srivastava on Medium]]></title>
        <description><![CDATA[Stories by Saumye Srivastava on Medium]]></description>
        <link>https://medium.com/@saumye?source=rss-a3aac2b1c302------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KG9UnVFDhWTQbDbTZ5nwqA.jpeg</url>
            <title>Stories by Saumye Srivastava on Medium</title>
            <link>https://medium.com/@saumye?source=rss-a3aac2b1c302------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 17:57:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saumye/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Spotting Latency Regressions Ahead of Time at Teams Mobile]]></title>
            <link>https://medium.com/microsoft-mobile-engineering/spotting-latency-regressions-ahead-of-time-at-teams-mobile-e0e5a5ef6390?source=rss-a3aac2b1c302------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0e5a5ef6390</guid>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Saumye Srivastava]]></dc:creator>
            <pubDate>Fri, 02 Feb 2024 18:18:47 GMT</pubDate>
            <atom:updated>2024-02-02T18:18:47.741Z</atom:updated>
            <content:encoded><![CDATA[<p>In the realm of mobile applications, subpar performance not only results in user frustration but also contributes to high user dissatisfaction scores (DSAT), a lower app Net Promoter Score (NPS), and increased uninstallations. Developers continually implement numerous code optimizations in each release, bringing about substantial improvements in App Vitals and critical user scenarios such as application launch, chat loading time, and channel loading time.</p><p>Our Android codebase sees contributions from over <strong>350</strong> developers on a monthly basis, with a staggering <strong>50+</strong> commits merged into the mainline every day. The pace of innovation remains high, as we introduce more than<strong> 20</strong> new features <strong>daily</strong> to our internal users across the organization and our partners.</p><p>In this dynamic environment, the need to maintain optimal app performance is paramount, emphasizing the importance of identifying and mitigating latency issues before they have a chance to impact user experience.</p><blockquote>All code is guilty until proven innocent.​</blockquote><blockquote>— Uncle Bob​</blockquote><h3>Scenario Measurement &amp; Monitoring</h3><p>We employ a method called scenario telemetry to measure execution time at the beginning and end of critical usage scenarios of our app. The latency telemetry for all usage scenarios is recorded in our database along with user details. The ScenarioContext handle facilitates the transfer of context information related to a user scenario throughout the app, including execution time, metadata, device information, status, steps, and correlation ID.</p><pre>fun onCreate() {<br>  val scenarioContext = scenarioManager.startScenario(AppScenarioNames.App.APP_START_WARM_FIRST_DRAW);<br>  // do critical work, load screen<br>  scenarioManager.stopScenario(scenarioContext);​<br>}</pre><p>Creating dashboards at Microsoft is a straightforward process, involving crafting a query on our internal portal that our internal framework executes every minute to chart into graphs. You can send the usage telemetry to your internal or third party Database and host a Grafana instance for building charts and monitors.</p><p>The data is fed from app usage from internal team, testers, canary users, beta users and early adopters to detect early signs of regressions across any of our usage scenarios. However, relying solely on latency-based graphs for observation has proven less effective.</p><ul><li><strong>Late discovery</strong> of regressions during rollouts resulted in delayed releases and fixes in some cases when alerts were extremely late.</li><li><strong>Pinpointing</strong> the cause of regressions became challenging once an increase in latency was noticed in a specific scenario, compounded by the numerous code changes introduced in each release as we have 1000s of commits going in release with many feature rollouts also in parallel.</li></ul><h3>Bouncer</h3><h4>Before&lt;&gt;After</h4><p>While our previous methods effectively identified substantial performance changes, due to the downsides we decided to build another system to move the detection as left as possible i.e. just after the regression merges to our mainline branch.</p><p>Given Microsoft Team’s expansive scale, this entailed scrutinising hundreds of commits on a change by change basis to identify regressions as minute as 15% which we set as our benchmark.</p><p>We did that by building a performance testing system that runs on our continuous integration servers running a performance test suite with instrumentation tests executing each of the scenarios <strong>before</strong> and <strong>after</strong> each commit merged on our main branch.</p><p>We run these tests after building our commits on our agents at Azure Dev Ops <a href="https://azure.microsoft.com/en-in/products/devops/pipelines">pipelines</a>, but <a href="https://github.blog/2022-02-02-build-ci-cd-pipeline-github-actions-four-steps/">Github actions</a> can be used to run the tests via <a href="https://developer.android.com/studio/test/command-line">am instrument</a> on built <strong>before-change/after-change</strong> APKs. For eg,</p><p>Before: { “featureFlag”: false } , After: { “featureFlag” : true }</p><p>Before: &lt;HEAD&gt;, After: &lt;HEAD&gt;~1</p><pre>private fun testScenarioLatency(​scenarioName: String,​ setup: () -&gt; Unit = {}, ​test: (iterationCount: Int) -&gt; Unit​) {​<br>  setup()​<br>  for (i in 0 until numWarmup) <br>    test(i) // Warmup Runs<br>  for (i in 0 until numIterations) <br>    test(i) // Test Runs   <br>  writeAllLatencyDataToFile(scenarioname)​<br>}<br><br>@Test​<br>@LongTimeOut​​​<br>fun testWarmLaunchByLauncher() {​<br>testScenarioLatency(​AppScenarioNames.App.APP_START_WARM_FIRST_DRAW,<br>setup = {​<br>  MainPage().apply {​<br>    navigate()​<br>    validate()​<br>  }​<br>},​<br>test = {​<br>  device.pressBack()​<br>  //.. execute the relevant scenario<br>}​)​<br>}</pre><p><a href="https://github.com/microsoft/HydraLab">Microsoft Hydralab</a> (open-source) built at Microsoft allows you to run Espresso based instrumentation tests on a self-hosted mobile lab with plugged in physical mobile devices. Our lab uniformly consists of only Pixel 4A devices connected to a HL host machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GA1mht-xmbeXnAkE8Pz27A.png" /></figure><p>We integrate our Android app with their <a href="https://github.com/microsoft/HydraLab/tree/main/gradle_plugin">gradle plugin</a> passing it relevant apks via your CI pipelines and the run supports multiple test result formats with attachment functionality from devices to CI artifacts for analysis in the pipelines. After each test run, we extract and upload the test logs, latency/memory data recorded per scenario, test recordings, and system traces from our devices to be analysed by our scripts in the final step.</p><p>Our final step does a median comparison of latency dataset of 9 iterations from test runs of both before and after builds failing builds on a set thresholds which is 10–15% across scenarios.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*fcjHYY3vunH-azwM7zOK1A.gif" /></figure><h3>Variance</h3><p>At the core of our pursuit for stability lies the ability to quantify and control variance of the system. We kickstarted our journey by capturing latency values across 10 iterations in a distribution indicating 10 runs of the scenario under test and then using the <a href="https://en.wikipedia.org/wiki/Coefficient_of_variation">coefficient of variation</a> (CoV) as our guiding metric.</p><p><strong>CoV</strong> = stdev([..distribution])/mean([..distribution])</p><p>We only onboard usage scenario metrics for feature teams on the framework only if <strong>CoV &lt; 0.15,</strong> but we are striving to go even lesser.</p><p>The key to success lies in minimising variance during test runs, ensuring that performance metrics remain stable across different iterations. In this article, we delve into the strategies employed by our team to reduce variance in test runs on Android devices, providing insights into the challenges faced and the innovative solutions implemented.</p><h4>On-Device Response Mocking</h4><p>Recognising the impact of varying API call response latencies on test run stability, we adopted for on-device response mocking. By redirecting all relevant API calls for test scenarios to mocked responses from the dedicated mock server, we eliminated the variance caused by live backend services.</p><p>Leveraging <a href="https://play.google.com/store/apps/details?id=com.termux&amp;hl=en&amp;gl=US">Termux</a>, a Terminal emulation app with Linux packages support for Android, we start our mock server directly on the device itself during tests and ensure our network layer polls localhost leading to a controlled and consistent results.</p><p>Enforce all API calls during the test to be mocked and fail tests if there are any live service calls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*lZHcvbNE_3cKga7FmC9IMA.png" /></figure><h4>Device Stability</h4><p>Android adjusts CPU frequency dynamically to enhance battery life and manage phone temperature. Consequently, the phone’s speed fluctuated as the device heated up.</p><p>To maintain performance consistency across our run, we obtain <strong>root</strong> access on all our devices during onboarding them to the system via <a href="https://github.com/topjohnwu/Magisk">Magisk</a>. That helps us perform below optimisations (very simplified for explanation) before every test run.</p><pre>echo 940000 &gt; /sys/devices/cpu/cpu(1..8)/cpufreq/scaling_max_freq # Lowest Supported frequency<br>echo 940000 &gt; /sys/devices/cpu/cpu(1..8)/cpufreq/scaling_min_freq # Lowest Supported frequency<br>echo performance &gt; /sys/devices/cpu/cpu(1..8)/cpufreq/scaling_governor<br><br>echo 0 &gt; /sys/devices/cpu/cpu(1..8)/hotplug/state # CPU Hotplugging<br>setprop ctl.stop mpdecision # MPDecision Service<br>stop thermal-engine || true # AOSP thermal controller<br>stop perfd || true # AOSP profiler,tracer<br>stop vendor.thermal-engine || true # thermal controller by vendor<br>stop vendor.perfd || true # profiler,tracer by vendor<br><br>settings put system accelerometer_rotation 0 # No rotation!<br>am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS # close dialogs before run<br><br># Animation related changes<br>settings put global window_animation_scale 0.0<br>settings put global transition_animation_scale 0.0<br>settings put global animator_duration_scale 0.0</pre><p>The Google <a href="https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-main/benchmark/gradle-plugin/src/main/resources/scripts/lockClocks.sh">lockClock</a> script was a good starting point but we have made a lot of changes on top such as in our choice of scaling_governor.</p><p>Additionally, A device health dashboard is critical to measure health metrics such as cpu metrics, temperature, storage, memory usage during test, median deviation across tests caused on this device.</p><h4>Test Run Stability</h4><p>Variance stability on test runs extends to not just the environment of execution but also the code under test.</p><p>Ensure the APK under test has been <strong>R8 </strong>optimised and has <strong>debugging</strong> disabled. We observed up to 50% stability in latencies just by the above 2 changes.</p><p>We execute full AOT(Ahead of Time) compilation using the below command before each test run and 3 warmup runs before all test suite performance measurement.</p><p>We also enable <a href="https://source.android.com/docs/core/power/performance#sustained_performance">Sustained Performance mode</a> used by game developers for consistent, reliable performance across diverse scenarios. Though many device manufacturers have not implemented a noop it’s good to enable this during test runs.</p><pre># AOT Compile test app<br>cmd package compile -f -m speed &lt;package-name&gt;<br><br># Enable R8, disable debuggable<br>debug {<br>  minifyEnabled true<br>  debuggable false<br>}</pre><h3>Outcome</h3><p>We now have commit by commit &amp; feature rollout by feature rollout stable latency data as each request merged to our mainline going through trials of the rigorous performance gates. We also now receive alerts for potential performance regressions far less frequently, and when alerted, it is more likely to signify a genuine regression.</p><p>This has streamlined our workload, eliminating the need for manual adjustments to static performance thresholds after each false positive and we are totalling roughly at 100k test runs over the past few quarters.</p><p>Performance tests against pull requests, which were consistently red due to the high probability of breaching at least one scenario as false positives regularly, are now predominantly green. When performance tests do indicate a red status, we have increased confidence that a genuine performance regression exists while we rerun the tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*ijrRg8OnNZkQXu3paqyqHQ.png" /><figcaption>Multiple such regressions caught and reverted in a day</figcaption></figure><h3>Conclusion</h3><p>Our hope is that by sharing these insights, others can navigate similar paths to triumph. The signal quality enhancements brought about by above design and methodologies have been a game-changer, allowing us to unearth regressions that once lurked in the shadows.</p><p>Bouncer has emerged as a crucial player in the performance team’s playbook at Microsoft Teams Mobile, rescuing teams from potential production-bound regressions.</p><p>Now, engineers can channel their efforts towards speeding up enhancements rather than grappling with regressions.​</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0e5a5ef6390" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-mobile-engineering/spotting-latency-regressions-ahead-of-time-at-teams-mobile-e0e5a5ef6390">Spotting Latency Regressions Ahead of Time at Teams Mobile</a> was originally published in <a href="https://medium.com/microsoft-mobile-engineering">Microsoft Mobile Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ammunition in the war against Teams Android build time]]></title>
            <link>https://medium.com/microsoft-mobile-engineering/ammunition-in-the-war-against-teams-android-build-time-2736a9c280ad?source=rss-a3aac2b1c302------2</link>
            <guid isPermaLink="false">https://medium.com/p/2736a9c280ad</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[build]]></category>
            <category><![CDATA[developer-productivity]]></category>
            <dc:creator><![CDATA[Saumye Srivastava]]></dc:creator>
            <pubDate>Wed, 03 May 2023 10:08:11 GMT</pubDate>
            <atom:updated>2023-05-03T10:10:46.566Z</atom:updated>
            <content:encoded><![CDATA[<p>The mobile industry is an ever-evolving space, with new innovations and updates being introduced regularly. This means that the competition is fierce, and every day counts in shipping features and bug fixes. The time it takes to build an Android app is a crucial factor that impacts developer productivity, which in turn can affect the app’s success. The percentage reduction in build time leads to percentage increase in shipping features and bug fixes. At Microsoft Teams Android, we understand this well and have been working relentlessly to improve our Android build time over the past quarter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sk5ZMMfzp7sjiH4alDkubw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ventiviews?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Venti Views</a> on <a href="https://unsplash.com/photos/FPKnAO-CF6M?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Our Android codebase comprises of 300+ modules that are contributed by hundreds of developers who run thousands of builds per day, both locally and in our Continuous Integration (CI) and Pull Request (PR) triggered pipelines.</p><h4>1. Build Telemetry</h4><p>We aimed to start by setting a baseline for our build configuration and execution time on both the project and task levels. To do so, we collected telemetry from all developers in different environments and machines.</p><p>We started with setting up build telemetry for each gradle task. For this we used <a href="https://docs.gradle.org/current/javadoc/org/gradle/api/execution/TaskExecutionAdapter.html">TaskExecutionAdapter</a> and <a href="https://docs.gradle.org/current/javadoc/org/gradle/BuildListener.html">BuildListener</a> that sent build telemetry to our monitoring servers by listening via the <a href="https://gradle.github.io/kotlin-dsl-docs/api/org.gradle.api.invocation/-gradle/add-listener.html">Gradle.addListener</a> API. Along with the gradle task execution time, we also sent device and development details, branch creation dates, cores, RAM, OS, and the list of modules changed.</p><p>Shortened output format,</p><blockquote>{‘Build_Time’: 82, ‘deviceId’: ‘&lt;&gt;’, ‘modelName’: ‘MacBook Pro’, ‘modelIdentifier’: ‘MacBookPro18,2’, ‘processorName’: ‘Apple M1 Max’, ‘totalCores’: ’10 (8 performance and 2 efficiency)’, ‘memory’: ’32 GB’, ‘timezone’: ‘+0530’, ‘task’: ‘preparekotlinbuildscriptmodel’, ‘taskData’: ‘{}’, ‘os’: ‘Darwin’, ‘cleanBuild’: False, ‘totalTaskTime’: 0, ‘versionName’: ‘1416/1.0.0.2023060799’, ‘modulesChanged’: ‘[“apps/teams”, “common/beacon”]’}</blockquote><p>This helped us collect data and build monitoring on a daily basis to validate regressions and improvements.</p><h4>2. Gradle Upgrade</h4><p>Gradle, the build system Teams Android codebase uses, comes with upgrades on a quarterly if not monthly basis. We upgraded to the latest Gradle version at regular intervals, going from 5.6 to 6.5 to 7.4 and now working on getting to 8.0. Every Gradle version comes with features, some of which are experimental, and multiple build performance improvements. Upgrading Gradle to the latest version led to a 30–40% improvement in build time.</p><p>Note that each upgrade comes with Gradle API deprecations, new lint rules needing disable or baselines, other build tool changes, library upgrades needed, and many other changes that are generally not anticipated thoroughly before diving in. For eg: Upgrade from 5 to 6 led to 1000s of lint breakages across the codebase due to new lint checks added every gradle update which had to be disabled and many plugin upgrades on older APIs.</p><h4>3. Compiler flags and conditional build process</h4><p>By default Android Studio enables all the steps in our build process for debug builds. We switched off multiple steps to speed up our dev build time using compiler flags such as below,</p><pre>def isRelease = gradle.startParameter.taskNames.contains(&quot;Release&quot;)<br>def disableABISplit = project.hasProperty(&quot;disableABISplit&quot;)<br>def disableResConfigs = project.hasProperty(&quot;disableResConfigs&quot;)<br>def disableCruncher = project.hasProperty(&quot;disableCruncher&quot;)<br>def enableMinify = project.hasProperty(&quot;enableMinify&quot;)</pre><p>Passing them through compile options cutting out minutes of build time by disabling minification, resource crunching, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0mnasUZnEvzObPKY-bl7Mg.png" /></figure><p>We also disabled multiple build features from our <strong>gradle.properties </strong>as the codebase doesn’t need them,</p><pre># Disable Build Features in modules by default unless enabled<br>android.defaults.buildfeatures.aidl=false<br>android.defaults.buildfeatures.renderscript=false<br>android.defaults.buildfeatures.resvalues=false<br>android.defaults.buildfeatures.shaders=false</pre><h4>4. Non-transitive R</h4><p>There are multiple <a href="https://blog.blundellapps.co.uk/speed-up-your-build-non-transitive-r-files/">blogs</a> about enabling android.nonTransitiveRClass gradle.properties. This strips resource IDs from transitive R files as from below diagram warranting fully qualifying imports at all places.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*dpZuBAnyKzYh5ISfWKhiSQ.jpeg" /></figure><p>This was a significant effort we took as part of a hackathon. We had thousands of files depending on this repeated R values. So we went with a pre-commit approach, by qualifying imports using the tool from Android Studio and then manually over few weeks. After 1600 file changes across 100s of modules we enabled the flag to work seamlessly.</p><p>Non-transitive R has improved our apk size by 2.6 MB by removing close to 400000+ resource IDs. This also breaks a lot of dependency among modules, improving our incremental build time by 13%.</p><h4>5. Gradle Lazy APIs</h4><p>Many of the scripts were using eager APIs from Gradle which ended up creating and registering a lot of tasks on configuration time. Many tasks may be used by only certain build variants or not needed to be configured for developer builds.</p><p>We mapped and replaced all APIs to lazy configure for Task avoidance and validated the avoidance with Gradle scans. You can follow the below link to map all your usages to lazy APIs across all your gradle build scripts,</p><p><a href="https://docs.gradle.org/current/userguide/task_configuration_avoidance.html#sec:old_vs_new_configuration_api_overview">https://docs.gradle.org/current/userguide/task_configuration_avoidance.html#sec:old_vs_new_configuration_api_overview</a></p><h4>6. Task input normalisation</h4><p>We observed on our gradle scans that many gradle tasks were not cached and realised we were passing timestamp with the task inputs inside build-info.properties. Adding normalisation ignores the file for cache keys in Gradle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CaBYCuyc7dWxRdnaBYuhZg.png" /></figure><p>Check your Gradle scans and ideally most tasks should come from cache on incremental runs, diagnose them if they don’t.</p><pre>normalization {<br>    runtimeClasspath {<br>        ignore &#39;build-info.properties&#39;<br>    }<br>}</pre><p>More reference below:</p><p><a href="https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:configure_input_normalization">Authoring Tasks</a></p><h4>7. Annotation processing optimisation</h4><p>Teams extensively uses Dagger across most modules for injection and we also have our own annotation processors for various internal code plus some other libraries using kapt.</p><p>We noticed kapt plugin being applied to multiple scripts even if the module was not using annotation processor so we cleaned that up. Apply annotation processor plugin only if necessary. Kapt verbose helps you in spotting why kapt is being run and which libraries are taking your most time.</p><p>With ksp on the block, kapt is on the sunset but till then the below should move the needle,</p><pre># KAPT properties<br># Enables verbose printer when kapt runs<br>kapt.verbose=true<br><br># Incremental annotation processing<br>kapt.incremental.apt=true<br><br># Includes annotation discovery on compile classpath vs runtime<br># https://kotlinlang.org/docs/kapt.html#compile-avoidance-for-kapt<br><br>kapt.include.compile.classpath=false<br>kapt.classloaders.cache.size=400 # &gt; Number of modules roughly</pre><h4>8. Compiler improvements</h4><p>Compilation is central part of the developer’s changes. The fastest way to compile is not to compile at all. We achieved massive compilation avoidance by our modularisation efforts and breaking dependency between modules.</p><p>Speeding up the compiler was the next step. We migrated java files to kotlin in some critical modules as mixed files lead to compiler taking a longer time and more memory. We also used the below flags to speed things up,</p><pre><br># File system watching by Gradle, https://blog.gradle.org/introducing-file-system-watching<br>org.gradle.vfs.watch=true <br><br># We use parallel GC for higher throughput and work with 10 GB heapspace for developer builds<br>org.gradle.jvmargs=-XX:+UseParallelGC -Xss4m -Xms2g -Xmx10g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:HeapDumpPath=/reports/heapDumps<br><br># Enables databinding annotation processors to work incrementally<br>android.databinding.incremental=true <br><br># https://youtrack.jetbrains.com/issue/KT-17621?_gl=1*1vkurzz*_ga*NzA5MzU5MTk0LjE2NzczMTI0NDU.*_ga_9J976DJZ68*MTY3ODcyMDUxMy4yLjEuMTY3ODcyMDUxNS41OC4wLjA.&amp;_ga=2.176926117.1409777141.1678720514-709359194.1677312445<br>kotlin.incremental.usePreciseJavaTracking=true # </pre><p>The other compilation improvements in the pipeline is using the K2 Compiler in Kotlin 2.0, migrating more modules to kotlin-only.</p><p><strong>9. Configuration Time</strong></p><p>Improving configuration time is critical as configuration is before every gradle task execution. We enabled configureOnDemand which calculates the task graph and configures only the tasks relevant for the Gradle task to be run instead of configuring all modules.</p><pre># Configures only modules that are needed for the executed task<br>org.gradle.configureondemand=true </pre><p><a href="https://docs.gradle.org/current/userguide/configuration_cache.html">Configuration cache</a> is under review due to incompatibility with certain plugins but once in, can give us around 20% improvement for our Gradle task runs. #5, #6, #7, #8, #9 have given us 10–15% improvements.</p><h4>10. Hardware</h4><p>One of the biggest gains we got in our build time and developer productivity was by moving to M1/M2 chips from Apple from the Intel based macbook machines. We noticed around 50% improvements in our builds from just switching to M1 Max Macbook pro machines.</p><p>New hardware is a big investment ask from the finance team and always needs a strong business case to make it worthwhile. Making a business case by mapping decrease in build time per build in median and 95th percentile to saved developer hours per month effectively attaches a $ value to it.</p><blockquote>Dev hours = est time saved in minutes per build /60 * avg no of builds/day/dev</blockquote><p>For eg for us,</p><p>6 minutes/60* 20 builds/day/dev = 2 dev hours per day</p><p>This means each dev can either ship 20% more from the product backlog, or 20% more devs can be hired or 20% cost can be saved. All three angles can be win-win-win. :)</p><h4>Closing</h4><p>All the above efforts meant consistent attacks at build time from whatever we could find on the internet. After going over some excellent talks, blogs, scouring Gradle docs, Google Developer videos and lots of reasoning over 10s if not 100s of gradle build scans we have dropped our build time from 9–10 minutes to under 5 minutes on average.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2736a9c280ad" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-mobile-engineering/ammunition-in-the-war-against-teams-android-build-time-2736a9c280ad">Ammunition in the war against Teams Android build time</a> was originally published in <a href="https://medium.com/microsoft-mobile-engineering">Microsoft Mobile Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How in-depth can you answer these as an Android engineer?]]></title>
            <link>https://saumye.medium.com/how-in-depth-can-you-answer-these-as-an-android-engineer-f61a7c2d736c?source=rss-a3aac2b1c302------2</link>
            <guid isPermaLink="false">https://medium.com/p/f61a7c2d736c</guid>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Saumye Srivastava]]></dc:creator>
            <pubDate>Sun, 17 Jan 2021 16:26:00 GMT</pubDate>
            <atom:updated>2021-01-17T16:26:00.289Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3MeZ82ZGV0WZH43skjs6iw.jpeg" /></figure><h3>How in-depth can you answer these as an experienced Android engineer?</h3><h4>The depth differentiates us from junior to a senior</h4><p>Android Framework System is a vastly complex system with a lot of moving parts. As mid-level/senior Android folks we are expected to know some and pick up a lot. This makes Android tech interviews hard at judging the candidate.</p><blockquote>“The ability to ask the right questions is more than half the battle of finding the answer” <br>- Thomas Watson</blockquote><p>After being interviewer at Flipkart and interviewing for companies like Uber, Microsoft &amp; Google and some startups, this is a list I worked on for Android folks to have answers to. This is not an exhaustive list on a must know everything basis but just something that would differentiate you as a candidate.</p><p>If you claim to know or worked in an area, having an extensive answer to the questions would give you an edge. Alternatively, this can also be used by folks in interviews or to ponder upon and top up their knowledge wells.</p><h3><strong>Questions</strong></h3><ol><li>How does layout inflation work from xml tags to view reference in memory? How are attributes read and drawn and how many passes does a view before it’s completely shown on screen?</li><li>How would you go about implementing findViewById? Given 2 view references, how would you go about finding their ancestor view?</li><li>Explain in complete detail on when you tap on a position/coordinate on phone say (140, 250), to the types of listeners fired, their priority on execution and event handling mechanism between child and parent layouts.</li><li>What is a thread, handler, looper and message queue?</li><li>What are the different methods of concurrency on Android? Can you explain the difference between ExecutorService vs CachedThreadPool vs FixedThreadPool vs AsyncTasks vs HandlerThreads?</li><li>How does Garbage Collection work on Android? Explain the terms reference counting, mark and sweep?</li><li>Think and list down all the different ways to communicate between an application component and a service?</li><li>When should you bind to a service, what is a ServiceConnection &amp; how does binding work internally?</li><li>What is the difference between using Messenger and AIDL? What are the advantages of using AIDL for interprocess communication?</li><li>In-memory vs Bundle vs SharedPrefs vs Database? What state do you persist in where?</li><li>List down all the ways that you can think of to reduce the apk size.</li><li>How is ANR, frame drop and frozen frames caused, how are they all different?</li><li>What are the 3 steps of Proguard/R8, how to enable and disable them?</li><li>What is consumer proguard, how is it different from Proguard?</li><li>How do we unobfuscate a stack trace of a Proguard/R8 obfuscated apk?</li><li>What is the difference between commit and apply in SharedPrefs? Which is more performant SharedPrefs vs Databases?</li><li>Describe how you could implement observable SharedPrefs or observable Databases i.e. Observe a certain key/table/query?</li><li>How is sharing data and sharing control between process on Android different? How would you do both?</li><li>What is the difference between Serializable and Parcelable? What are the disadvantages of Serializable?</li><li>What are the different ways to protect api key inside a shipped apk?</li><li>What is a man in the middle attack, how do you secure your apis from it and other attacks?</li><li>What are the steps in Android build process from java/kt files to packaging? Explain in detail what is R.java, resources.arsc, manifest merging &amp; signing etc.</li><li>How is app bundle different from apk? What are build flavours and how are they different from product flavours and splits?</li><li>How would you communicate between an Activity &amp; Activity, Fragment &amp; Fragment and Activity &amp; Fragment?</li><li>What are the different activity launch modes?</li><li>What is the viewholder pattern, how will you implement it on a ListView? Explain the best practice to specify the listeners on the items inside the RecyclerView?</li><li>What are the steps you can think of optimising RecyclerView performance?</li><li>How would you implement a Sticky header in a RecyclerView from scratch.</li><li>How is change in the dataset reflected in the RecyclerView? What is DiffUtil?</li><li>What is Reflection in Java and why is it advised to use minimally?</li><li>What are Generics in Java? In what cases are they useful and how do you restrict them?</li><li>What is a Content Provider in Android and how do you access the content it provides?</li><li>Implement an Android Content Provider on top of a dataset of comma separated files. Is it possible?</li><li>How is data stored on databases on Android? What is an ORM &amp; a Data Access Object? What are some ways to optimise Database read, write and update?</li><li>How thread safe is SQLite? Table-level lock or DB-level lock?</li><li>What is Dependency Injection Pattern? How does it compare to Service Registry Pattern?</li><li>What are Dagger and Koin and how do they internally work?</li><li>What are the problems around security when dealing with webviews.</li><li>What is the different between unit and instrumentation tests? Mockito vs RoboElectric?</li><li>What is CI/CD in context of Android? What are the pipelines and their guard-rails you have encountered in your experience before code merge, testing, release &amp; rollout?</li></ol><p><em>I’m available on </em><a href="https://www.linkedin.com/in/saumye/"><em>linkedin</em></a><em> &amp; </em><a href="https://twitter.com/saumyesrivastav"><em>twitter</em></a><em> for any questions or feedback. I’m planning to get my hands dirty on medium, so let’s have a chat when you think I have missed something crucial, </em><strong><em>I know I have :) </em></strong><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f61a7c2d736c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>