<?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 Nicholas Miller on Medium]]></title>
        <description><![CDATA[Stories by Nicholas Miller on Medium]]></description>
        <link>https://medium.com/@nickbryanmiller?source=rss-ba68c6ee8dae------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KK7Mlk2Y3MgUt4kkNcSQaw.png</url>
            <title>Stories by Nicholas Miller on Medium</title>
            <link>https://medium.com/@nickbryanmiller?source=rss-ba68c6ee8dae------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:42:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nickbryanmiller/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[Airbnb’s Page Performance Score on iOS]]></title>
            <link>https://medium.com/airbnb-engineering/airbnbs-page-performance-score-on-ios-36d5f200bc73?source=rss-ba68c6ee8dae------2</link>
            <guid isPermaLink="false">https://medium.com/p/36d5f200bc73</guid>
            <category><![CDATA[performance-management]]></category>
            <category><![CDATA[metrics]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[Nicholas Miller]]></dc:creator>
            <pubDate>Mon, 13 Dec 2021 15:41:02 GMT</pubDate>
            <atom:updated>2026-07-09T21:53:34.174Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This is a continuation of our series on </em><a href="https://medium.com/airbnb-engineering/creating-airbnbs-page-performance-score-5f664be0936"><em>Airbnb’s Page Performance Score</em></a><em>, a score that measures multiple performance metrics from real users on any platform. Series: </em><a href="https://medium.com/airbnb-engineering/creating-airbnbs-page-performance-score-5f664be0936"><em>Part 1</em></a><em> and </em><a href="https://medium.com/airbnb-engineering/measuring-web-performance-at-airbnb-122da8d3ea3f"><em>Part 2</em></a><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*33B60glCNf0ePfNHrvwYew.jpeg" /></figure><p><strong>By</strong>: <a href="https://www.linkedin.com/in/nickbryanmiller/">Nicholas Miller</a></p><p>At Airbnb, we created the <a href="https://medium.com/airbnb-engineering/creating-airbnbs-page-performance-score-5f664be0936">Page Performance Score</a> to provide our engineers and data scientists a multitude of user-centric performance metrics to better understand and improve our products. In this post, we will dive deeper into how we define these metrics and instrument them on iOS.</p><h3>Page system</h3><p>The entire customer journey on Airbnb is divided into different pages, each of which has its own measured <a href="https://medium.com/airbnb-engineering/creating-airbnbs-page-performance-score-5f664be0936">Page Performance Score</a> (PPS). In order to support this page-based performance tracking system, we built a standardized infrastructure that enables engineers to configure pages representing their features.</p><p>On iOS, a page is associated with a <em>UIViewController</em>. We collect performance data throughout a <em>UIViewController’s</em> lifecycle and only emit the logging event on <em>viewDidDisappear</em>. This logging event cannot be created or sent without a <em>PageName,</em> a universal page identifier.</p><h3>Instrumentation</h3><p>Due to the many edge cases and complexities involved in instrumenting these metrics, we created a Page Performance Score state machine class, called <em>PPSStateMachine</em>. This class encapsulates all the logic to track and compute the performance metrics and generate logging events. Any engineer who wants to log a PPS event can do so by obtaining the <em>PPSStateMachine</em> associated with their <em>UIViewController</em> and calling the relevant methods during the <em>UIViewController’s</em> lifecycle events. To make things even simpler, we’ve built additional tooling and infrastructure so engineers only need to provide a name for their page and the state of the content — e.g., loading, loaded, or error.</p><h3>PPSStateMachine</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b7970243975a6ca0835748fa6a420d4/href">https://medium.com/media/8b7970243975a6ca0835748fa6a420d4/href</a></iframe><h3>Time</h3><p>When measuring performance, all time is measured in nanoseconds and then converted into milliseconds. By creating a typealias for the concept of nanoseconds (UInt64) and milliseconds (Float64) to more specific types, we force developers to think about the scale when converting to more commonly used types (e.g., Int, Float).</p><p>When taking the current time, we use a monotonic clock, a clock whose value increments monotonically and will continue to increment while the system is asleep. The value is of type 64-bit nanoseconds.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4da33b57f34e75dc4693667295bf3756/href">https://medium.com/media/4da33b57f34e75dc4693667295bf3756/href</a></iframe><p>When marking the start and end time of a duration, we have a computed variable that returns the current time in milliseconds. This allows us to avoid most accuracy and precision errors due to casting.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3c2a7aa8281b995ca3e0dbe6f3d50a6/href">https://medium.com/media/e3c2a7aa8281b995ca3e0dbe6f3d50a6/href</a></iframe><h4>Example</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/602ff441004751e85ff5e03dc96c00f8/href">https://medium.com/media/602ff441004751e85ff5e03dc96c00f8/href</a></iframe><h3>View association</h3><p>Every <em>UIViewController</em> has an associated <em>PPSStateMachine</em>. This <em>PPSStateMachine</em> can be overridden in the event the developer wants to measure a series of pages under one name. Associating with a <em>UIViewController</em> allows the <em>PPSStateMachine</em> to be found on a <em>UIView</em> by crawling the view responder chain.</p><h3>Versioning</h3><p>Declaring lifecycle and semantic methods in the PPS protocol allows us to abstract away how the score is being calculated. Most updates to the PPS formula — with the exception of entirely new metrics such as video performance — do not result in developers needing to update their respective features. Behind the scenes, any major change to the formula is first tested by placing the potential value into the logged event’s metadata. Once the potential value is validated, it can be upgraded to an official value that affects the page’s performance score.</p><h3>Metric implementation</h3><h3>Time to First Layout (TTFL)</h3><p>TTFL starts during the UIViewController’s viewDidLoad and ends after the UIViewController’s first viewDidLayoutSubviews.</p><h3>Time to Initial Load (TTIL)</h3><p>TTIL starts during the UIViewController’s viewDidLoad and ends one render cycle after loaded content has been set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*EW0b3z7ZpIrJhtzI0W2DSA.gif" /><figcaption>This is for illustrative purposes only and does not necessarily show anything that may or may not be available on Airbnb at any time. The content shown in the image may or may not be correct.</figcaption></figure><h3>Scroll Thread Hangs (STH)</h3><p>STHs are reported as the difference between the duration of the hitch, filtering on a minimum threshold of twice the refresh rate, and the maximum frame duration.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00bf78cd12435d8512756b05c21010fe/href">https://medium.com/media/00bf78cd12435d8512756b05c21010fe/href</a></iframe><p><a href="https://developer.apple.com/documentation/quartzcore/cadisplaylink"><em>CADisplayLink</em></a> accurately observes most STHs. The <em>RunLoop.Mode</em> is <em>RunLoop.Mode.Tracking</em>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f2dc1fc5848b1350fe493e5bc09d6bc/href">https://medium.com/media/5f2dc1fc5848b1350fe493e5bc09d6bc/href</a></iframe><p>Every time the display link is fired, we make a calculation based on the old frame and the current frame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*D9y4xHtuKdAEf1ytdM-iEQ.gif" /><figcaption>This is for illustrative purposes only and does not necessarily show anything that may or may not be available on Airbnb at any time. The content shown in the image may or may not be correct.</figcaption></figure><p>Main Thread Hangs (MTH) tracking could exist on iOS, however, accurately tracking MTH incurs a small but consistent drag on performance. In our tests of MTH tracking, the CPU was not able to sleep, battery was drained, and the metric wasn’t giving us significantly more information regarding visually-perceived performance than STH. As a result, we decided not to measure MTH on iOS.</p><h3>Additional Load Time (ALT)</h3><p>ALT starts when a loader is shown and ends one render cycle after the loader is gone and content is set.</p><p>To illustrate this metric, let’s take a look at infinite scroll. If the bottom is reached before the next page has been loaded then the ALT recorded is the time that the loader (or bottom) is visible until the next page has loaded. If the bottom is never reached, for instance, due to prefetching, then an ALT of zero is logged. In order to accurately log, we need to know the scroll percentage, whether the bottom loader is visible, and a state machine to track the old state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*WTBC00sL2fp9MW5xom2jpA.gif" /><figcaption>This is for illustrative purposes only and does not necessarily show anything that may or may not be available on Airbnb at any time. The content shown in the image may or may not be correct.</figcaption></figure><h3>Rich Content Load Time (RCLT)</h3><p>RCLT is entirely hidden from engineers with our view abstraction, <em>URLImageView</em>, which is capable of showing an image from a URL.</p><p>RCLT only tracks the time that a loader or placeholder is visible. If a loading image is hidden then the act of hiding marks the end of the RCLT.</p><p>On every <em>URLImageView</em> state change the corresponding <em>PPSStateMachine</em> is found by crawling the view’s responder chain and updating the state machine with whether the image is loaded or not. The <em>PPSStateMachine</em> will calculate the duration and remove the URL portion, only saving the duration, if the duration is under a specified threshold so that logs are not too large.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d853ace6c3ccfbb5d418efdf36e1842/href">https://medium.com/media/0d853ace6c3ccfbb5d418efdf36e1842/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*FDRRuig-2gi_9IZP" /><figcaption>This is for illustrative purposes only and does not necessarily show anything that may or may not be available on Airbnb at any time. The content shown in the image may or may not be correct.</figcaption></figure><h3>Summary</h3><p>Our current implementation of PPS on iOS has allowed engineers to quickly implement and receive real performance data. We are continually evolving and expanding our tooling and infrastructure. We hope that you can apply and advance our learnings in your company.</p><h4>Appreciations</h4><p>Thank you to everyone who has helped build PPS on Native: <a href="https://www.linkedin.com/search/results/all/?keywords=luping%20lin&amp;origin=RICH_QUERY_SUGGESTION&amp;position=0&amp;searchId=58011edb-813b-43c3-9f00-f886aa446e84&amp;sid=VYi">Luping Lin</a>, <a href="https://www.linkedin.com/in/hdezninirola/">Antonio Niñirola</a>, <a href="https://www.linkedin.com/in/kellerbryan19/">Bryan Keller</a>, <a href="https://www.linkedin.com/in/noahsmartin/">Noah Martin</a>, <a href="https://www.linkedin.com/in/scheuermann/">Andrew Scheuermann</a>, <a href="https://www.linkedin.com/search/results/all/?keywords=joshua%20nelson%20%E2%9C%A8&amp;origin=RICH_QUERY_SUGGESTION&amp;position=0&amp;searchId=959d4aca-c80e-448a-b415-4a732ba7a84d&amp;sid=Rr6">Josh Nelson</a>, <a href="https://www.linkedin.com/in/joshpolsky/">Josh Polsky</a>, <a href="https://www.linkedin.com/in/jnvollmer/">Jean-Nicolas Vollmer</a>, <a href="https://www.linkedin.com/in/wensheng-mao-76ab7142/">Wensheng Mao</a> and everyone else who helped along the way.</p><p><em>All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36d5f200bc73" width="1" height="1" alt=""><hr><p><a href="https://medium.com/airbnb-engineering/airbnbs-page-performance-score-on-ios-36d5f200bc73">Airbnb’s Page Performance Score on iOS</a> was originally published in <a href="https://medium.com/airbnb-engineering">The Airbnb Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>