- Delphi High Performance
- Primo? Gabrijelcic
- 313字
- 2021-06-24 19:22:58
Different types of speed
It is obvious from the previous example that we don't always mean the same thing when we talk about a program's speed. There is a real speed, as in the database example, and there is a perceived speed, hinted at in the document editor and game scenario. Sometimes we don't need to improve the program speed at all. We just have to make it not stutter while working (by making the user interface responsive at all times) and users will be happy.
We will deal with two types of performance in this book:
- Programs that react quickly to user input
- Programs that perform computations quickly
As you'll see, the techniques to achieve the former and the latter are somehow different. To make a program react quickly, we can sometimes just put a long operation (as was the calculation of the next move in the fictitious game) into a background thread. The code will still run as long as in the original version but the user interface won't be blocked and everybody will be happy.
To speed up a program (which can also help with a slowly-reacting user interface), we can use different techniques, from changing the algorithm to changing the code so that it will use more than one CPU at once to using a hand-optimized version, either written by us or imported from an external library.
To do anything, we have to know which part of the code is causing a problem. If we are dealing with a big legacy program, problematic part may be hard to find. In the rest of this chapter, we will look at different ways to locate such code. We'll start by taking an educated guess and then we'll improve that by measuring the code speed, first by using home-grown tools and then with a few different open source and commercial programs.
- SQL Server 2008數據庫應用技術(第二版)
- R數據科學實戰:工具詳解與案例分析(鮮讀版)
- Sybase數據庫在UNIX、Windows上的實施和管理
- 重復數據刪除技術:面向大數據管理的縮減技術
- 探索新型智庫發展之路:藍迪國際智庫報告·2015(上冊)
- 區域云計算和大數據產業發展:浙江樣板
- 改變未來的九大算法
- 區塊鏈+:落地場景與應用實戰
- Gideros Mobile Game Development
- 數據挖掘競賽實戰:方法與案例
- 中國云存儲發展報告
- Spring Boot 2.0 Cookbook(Second Edition)
- 改進的群智能算法及其應用
- 數據應用工程:方法論與實踐
- Unity Game Development Blueprints