Skip to content

Commit

Permalink
chapter 1 section 2 edits
Browse files Browse the repository at this point in the history
Whenever you have a numeric range, you want what's called
an "en dash" (–, U+2013). Ala LaTeX, this is done in pandoc
via two hyphens without whitespace. I'm using these
wherever appropriate.

Whenever you have a break in thought, you want an em dash
(—, U+2014). Ala LaTeX, this is done via three hyphens,
yadda yadda.

I think I've managed to avoid most stylistic edits.
  • Loading branch information
dankamongmen committed Sep 6, 2024
1 parent 204d355 commit 8480e1e
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions chapters/1-Introduction/1-2 Why Care about Performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,54 @@ For many years performance engineering was a nerdy niche, but now it's becoming

It is fairly easy to reach performance level 4 in Table @tbl:PlentyOfRoom. In fact, you don't need this book to get there. Write your program in one of the native programming languages, distribute work among multiple threads, pick a good optimizing compiler and you'll get there. Unfortunately, this will only put you halfway to the desired efficiency target.

The methodologies in this book focus on squeezing out the last bit of performance from your application. Such transformations can be attributed along rows 6 and 7 in Table @tbl:PlentyOfRoom. The types of improvements that will be discussed are usually not big and often do not exceed 10%. However, do not underestimate the importance of a 10% speedup. SQLite is commonplace today not because its developers sat one day and decided to make it 50% faster. But because they meticulously made hundreds of 0.1% improvements over the years. The cumulative effect of these small improvements is what makes the difference.
The methodologies in this book focus on squeezing out the last bit of performance from your application. Such transformations can be attributed along rows 6 and 7 in Table @tbl:PlentyOfRoom. The types of improvements that will be discussed are usually not big and often do not exceed 10%. However, do not underestimate the importance of a 10% speedup. SQLite is commonplace today not because its developers one day made it 50% faster, but because they meticulously made hundreds of 0.1% improvements over the years. The cumulative effect of these small improvements is what makes the difference.

The impact of small improvements is very relevant for large distributed applications running in the cloud. According to [@HennessyGoogleIO], in the year 2018, Google spent roughly the same amount of money on actual computing servers that run the cloud as it spent on power and cooling infrastructure. Energy efficiency is a very important problem, which can be improved by optimizing software.

> "At such [Google] scale, understanding performance characteristics becomes criticaleven small improvements in performance or utilization can translate into immense cost savings." [@GoogleProfiling]
> "At such [Google] scale, understanding performance characteristics becomes critical–--even small improvements in performance or utilization can translate into immense cost savings." [@GoogleProfiling]
In addition to cloud costs, there is another factor at play: how people perceive slow software. For instance, Google reported that a 2% slower search caused [2% fewer searches](https://assets.en.oreilly.com/1/event/29/Keynote Presentation 2.pdf) per user.[^3] For Yahoo! 400 milliseconds faster page load caused [5-9% more traffic](https://www.slideshare.net/stoyan/dont-make-me-wait-or-building-highperformance-web-applications).[^8] In the game of big numbers, small improvements can make a significant impact. Such examples prove that the slower the service works, the fewer people will use it.
In addition to cloud costs, there is another factor at play: how people perceive slow software. Google reported that a 2% slower search caused [2% fewer searches](https://assets.en.oreilly.com/1/event/29/Keynote Presentation 2.pdf) per user.[^3] For Yahoo! 400 milliseconds faster page load caused [5-9% more traffic](https://www.slideshare.net/stoyan/dont-make-me-wait-or-building-highperformance-web-applications).[^8] In the game of big numbers, small improvements can make a significant impact. The slower a service works, the fewer people will use it.

Outside cloud services, there are many other performance-critical industries where performance engineering does not need to be justified, such as Artificial Intelligence (AI), High-Performance Computing (HPC), High-Frequency Trading (HFT), Game Development, etc. Moreover, performance is not only required in highly specialized areas, it is also relevant for general-purpose applications and services. Many tools that we use every day simply would not exist if they failed to meet their performance requirements. For example, Visual C++ [IntelliSense](https://docs.microsoft.com/en-us/visualstudio/ide/visual-cpp-intellisense)[^2] features that are integrated into Microsoft Visual Studio IDE have very tight performance constraints. For the IntelliSense autocomplete feature to work, they have to parse the entire source codebase in the order of milliseconds.[^9] Nobody will use a source code editor if it takes several seconds to suggest autocomplete options. Such a feature has to be very responsive and provide valid continuations as the user types new code.
Outside cloud services, there are many other performance-critical industries where performance engineering does not need to be justified, such as Artificial Intelligence (AI), High-Performance Computing (HPC), High-Frequency Trading (HFT), game development, etc. Moreover, performance is not only required in highly specialized areas, it is also relevant for general-purpose applications and services. Many tools that we use every day simply would not exist if they failed to meet their performance requirements. For example, Visual C++ [IntelliSense](https://docs.microsoft.com/en-us/visualstudio/ide/visual-cpp-intellisense)[^2] features that are integrated into Microsoft Visual Studio IDE have very tight performance constraints. For the IntelliSense autocomplete feature to work, it must parse the entire source codebase in milliseconds.[^9] Nobody will use a source code editor if it takes several seconds to suggest autocomplete options. Such a feature has to be very responsive and provide valid continuations as the user types new code.

> "Not all fast software is world-class, but all world-class software is fast. Performance is _the_ killer feature." - Tobi Lutke, CEO of Shopify.
> "Not all fast software is world-class, but all world-class software is fast. Performance is _the_ killer feature." ---Tobi Lutke, CEO of Shopify.
I hope it goes without saying that people hate using slow software. Especially when their productivity goes down because of it. Table 2 shows that most people consider a delay of 2 seconds or more to be a "long wait", and would switch to something else after 10 seconds of waiting (I think much sooner). If you want to keep user's attention, you've better have your application to react quickly.
I hope it goes without saying that people hate using slow software, especially when their productivity goes down because of it. Table 2 shows that most people consider a delay of 2 seconds or more to be a "long wait," and would switch to something else after 10 seconds of waiting (I think much sooner). If you want to keep users' attention, your application must react quickly.

Performance characteristics of an application can be a single factor for your customer to switch to a competitor's product. By putting emphasis on performance, you can give your product a competitive advantage.
Application performance can drive your customers to a competitor's product. By emphasizing performance, you can give your product a competitive advantage.

Sometimes fast tools find use in the areas they were not initially designed for. For example, nowadays, game engines like Unreal and Unity are used in architecture, 3d visualization, filmmaking, and other areas. Because game engines are so performant, they are a natural choice for applications that require 2d and 3d rendering, physics simulation, collision detection, sound, animation, etc.
Sometimes fast tools find applications for which they were not initially designed. For example, game engines like Unreal and Unity are used in architecture, 3D visualization, filmmaking, and other areas. Because game engines are so performant, they are a natural choice for applications that require 2D and 3D rendering, physics simulation, collision detection, sound, animation, etc.

-----------------------------------------------------------------------------
Interaction Human Perception Response Time
Class

------------- ----------------------------------------------- --------------
Fast Minimally noticeable delay 100ms - 200ms
Fast Minimally noticeable delay 100ms--200ms

Interactive Quick, but too slow to be described as Fast 300ms - 500ms
Interactive Quick, but too slow to be described as Fast 300ms--500ms

Pause Not quick but still feels responsive 500ms - 1 sec
Pause Not quick but still feels responsive 500ms--1 sec

Wait Not quick due to amount of work for scenario 1 sec - 3 sec
Wait Not quick due to amount of work for scenario 1 sec--3 sec

Long Wait No longer feels responsive 2 sec - 5 sec
Long Wait No longer feels responsive 2 sec--5 sec

Captive Reserved for unavoidably long/complex scenarios 5 sec - 10 sec
Captive Reserved for unavoidably long/complex scenarios 5 sec--10 sec

Long-running User will probably switch away during operation 10 sec - 30 sec
Long-running User will probably switch away during operation 10 sec--30 sec

------------------------------------------------------------------------------

Table: Human-software interaction classes. *Source: Microsoft Windows Blogs*.[^11] {#tbl:WindowsResponsiveness}

> “Fast tools don’t just allow users to accomplish tasks faster; they allow users to accomplish entirely new types of tasks, in entirely new ways.” - Nelson Elhage wrote in his blog.[^1]
Before starting performance-related work, make sure you have a strong reason to do so. Optimization just for optimization’s sake is useless if it doesn’t add value to your product.[^10] Mindful performance engineering starts with clearly defined performance goals, stating what you are trying to achieve and why you are doing it. Also, you should pick the metrics that you will use to measure whether you reach the goal or not.
Before starting performance-related work, make sure you have a strong reason to do so. Optimization just for optimization’s sake is useless if it doesn’t add value to your product.[^10] Mindful performance engineering starts with clearly defined performance goals. Understand clearly what you are trying to achieve, and justify the work. Establish metrics that you will use to measure success.

Now that we've talked about the value of performance engineering, let's uncover what it consists of. When you're trying to improve the performance of a program, you need to find what to improve (performance analysis) and then improve it (tuning), which is very similar to a regular debugging activity. This is what we will discuss next.
Now that we've talked about the value of performance engineering, let's uncover what it consists of. When you're trying to improve the performance of a program, you need to find problems (performance analysis) and then improve them (tuning), a task very similar to a regular debugging activity. This is what we will discuss next.

[^12]: From the late 1990s to the late 2000s where personal computers dominated the market of computing devices.
[^12]: The late 1990s and early 2000s, a time dominated by personal computers.
[^4]: In 2024, Meta uses mostly on-premise cloud, while Netflix uses AWS public cloud.
[^5]: Worldwide spending on cloud services in 2020 - [https://www.srgresearch.com/articles/2020-the-year-that-cloud-service-revenues-finally-dwarfed-enterprise-spending-on-data-centers](https://www.srgresearch.com/articles/2020-the-year-that-cloud-service-revenues-finally-dwarfed-enterprise-spending-on-data-centers)
[^6]: Worldwide spending on cloud services in 2024 - [https://www.gartner.com/en/newsroom/press-releases/2024-05-20-gartner-forecasts-worldwide-public-cloud-end-user-spending-to-surpass-675-billion-in-2024](https://www.gartner.com/en/newsroom/press-releases/2024-05-20-gartner-forecasts-worldwide-public-cloud-end-user-spending-to-surpass-675-billion-in-2024)
Expand Down

0 comments on commit 8480e1e

Please sign in to comment.