- ASP.NET Core 2 High Performance(Second Edition)
- James Singleton
- 314字
- 2021-07-08 09:39:01
When performance matters
Performance is not always important in every situation. Learning when performance does and doesn't matter is an important skill to acquire. A general rule of thumb is that if the user has to wait for something to happen, then it should perform well. If this is something that can be performed asynchronously, then the constraints are not as strict, unless an operation is so slow that it takes longer than the time window for it, for example, an overnight batch job on an old financial services mainframe.
A good example from a web application standpoint is rendering a user view versus sending an email. It is a common, yet naive, practice to accept a form submission and send an email (or worse, many emails) before returning the result. Yet, unlike a database update, an email is not something that needs to happen instantly. There are many stages over which we have no control that will delay an email in reaching a user. Therefore, there is no need to send an email before returning the result of the form. You can do this in the background and asynchronously, after the result of the form submission is returned.
The important thing to remember here is that it is the perception of performance that matters and not absolute performance. It can be better to not perform some demanding work (or at least defer it until later) rather than speed it up.
This may be counter-intuitive, especially considering how individual computational operations can be too quick to perceive. However, the multiplying factor is scaled. One operation may be relatively quick, but millions of them may accumulate to a visible delay. Optimizing these will have a corresponding effect due to the magnification. Improving code that runs in a tight loop or for every user is better than fixing a routine that runs only once a day.
- Qt 5 and OpenCV 4 Computer Vision Projects
- 新一代通用視頻編碼H.266/VVC:原理、標(biāo)準(zhǔn)與實(shí)現(xiàn)
- 騰訊iOS測(cè)試實(shí)踐
- Mastering Google App Engine
- Java EE 7 Performance Tuning and Optimization
- Python Essentials
- 數(shù)據(jù)分析與挖掘算法:Python實(shí)戰(zhàn)
- Scratch從入門到精通
- Hands-On Dependency Injection in Go
- Processing開發(fā)實(shí)戰(zhàn)
- LabVIEW數(shù)據(jù)采集(第2版)
- Spring Boot 2+Thymeleaf企業(yè)應(yīng)用實(shí)戰(zhàn)
- 計(jì)算機(jī)軟件項(xiàng)目實(shí)訓(xùn)指導(dǎo)
- Neo4j權(quán)威指南 (圖數(shù)據(jù)庫技術(shù)叢書)
- 面向?qū)ο蟪绦蛟O(shè)計(jì)及C++實(shí)驗(yàn)指導(dǎo)(第3版)