Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Delphi High Performance

You're reading from   Delphi High Performance Build fast Delphi applications using concurrency, parallel programming and memory management

Arrow left icon
Product type Paperback
Published in Feb 2018
Publisher Packt
ISBN-13 9781788625456
Length 336 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Primož Gabrijelčič Primož Gabrijelčič
Author Profile Icon Primož Gabrijelčič
Primož Gabrijelčič
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. About Performance 2. Fixing the Algorithm FREE CHAPTER 3. Fine-Tuning the Code 4. Memory Management 5. Getting Started with the Parallel World 6. Working with Parallel Tools 7. Exploring Parallel Practices 8. Using External Libraries 9. Best Practices 10. Other Books You May Enjoy

Fixing the algorithm


My preferred approach to improving performance is—always—fixing the algorithm. Look at it this way—if we need 1 time unit to process one data item, and the algorithm is O(n2), we need 10,000 time units to process an input of size 100. If you fine-tune the code and speed up the operation by 50% (which is an excellent result), the code will need 5000 time units to do the job. If you, however, change the algorithm to O(n log n), it will need in the order of 1000 time units or less. Even if processing one item takes 100% longer than in the original code, the whole process will run in, say, 2000 time units.

Note

An algorithm with lower complexity will beat an algorithm with higher complexity, even if the latter executes its steps faster.

As it's impossible to give one piece of advice that will fix all your problems, Chapter 2Fixing the Algorithm, looked into different user stories. The first topic was about responsive user interfaces. A program's UI can lag or block for different...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime