Примож Габриэльчич - Высокая производительность Delphi (черновик перевода глав 1-2)
Название: | Высокая производительность Delphi (черновик перевода глав 1-2) | |
Автор: | Примож Габриэльчич | |
Жанр: | Самиздат, сетевая литература, Учебники и самоучители по компьютеру, Литература ХXI века (эпоха Глобализации экономики), Любительские переводы, Pascal, Delphi, Lazarus и т.п., Параллельное и распределенное программирование | |
Изадано в серии: | неизвестно | |
Издательство: | Интернет-издательство «Stribog» | |
Год издания: | 2021 | |
ISBN: | неизвестно | |
Отзывы: | Комментировать | |
Рейтинг: | ||
Поделись книгой с друзьями! Помощь сайту: донат на оплату сервера |
Краткое содержание книги "Высокая производительность Delphi (черновик перевода глав 1-2)"
Создание быстрых приложений на Delphi с использованием конкурентности, параллельного программирования и управления памятью.
Читаем онлайн "Высокая производительность Delphi (черновик перевода глав 1-2)". [Страница - 2]
- 1
- 2
- 3
- 4
- . . .
- последняя (106) »
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
About Performance
What is performance?
Different types of speed
Algorithm complexity
Big O and Delphi data structures
Data structures in practice
Mr. Smith's first program
Looking at code through the Big O eyes
Don't guess, measure!
Profiling with TStopwatch
Profilers
AsmProfiler
Sampling Profiler
AQTime
Nexus Quality Suite
Summary
Fixing the Algorithm
Responsive user interfaces
Updating a progress bar
Bulk updates
Virtual display
Caching
Dynamic cache
Speeding up SlowCode
Summary
Fine-Tuning the Code
Delphi compiler settings
Code inlining control
Optimization
Record field alignment
Assertions
Overflow checking
Range checking
Extracting common expressions
The helpful CPU window
Behind the scenes
A plethora of types
Simple types
Strings
Arrays
Records
Classes
Interfaces
Optimizing method calls
Parameter passing
Method inlining
The magic of pointers
Going the assembler way
Returning to SlowCode
Summary
Memory Management
Optimizing strings and array allocations
Memory management functions
Dynamic record allocation
FastMM internals
Memory allocation in a parallel world
Replacing the default memory manager
ScaleMM
TBBMalloc
Fine-tuning SlowCode
Summary
Getting Started with the Parallel World
Processes and threads
When to parallelize the code?
Most common problems
Never access UI from a background thread
Simultaneous reading and writing
Sharing a variable
Synchronization
Critical sections
Other locking mechanisms
A short note on coding style
Shared data with built-in locking
Interlocked operations
Object life cycle
Communication
Windows messages
Synchronize and Queue
Polling
Performance
Third-party libraries
Summary
Working with Parallel Tools
TThread
Advanced TThread
Setting up a communication channel
Sending messages from a thread
Implementing a timer
Summary
Exploring Parallel Practices
Tasks and patterns
Variable capturing
Tasks
Exceptions in tasks
Parallelizing a loop
Thread pooling
Async/Await
Join
Join/Await
Future
Parallel for
Pipelines
Creating the pipeline
Stages
Displaying the result and shutting down
Summary
Using External Libraries
Using object files
Object file formats
Object file linking in practice
Using C++ libraries
Using a proxy DLL in Delphi
Summary
Best Practices
About performance
Fixing the algorithm
Fine-tuning the code
Memory management
Getting started with the parallel world
Working with parallel tools
Exploring parallel practices
Using external libraries
Final words
Other Books You May Enjoy
Leave a review - let other readers know what you think
Preface
Performance matters!I started programming on 8-bit micros, and boy, was that an interesting time! Memory was typically not a problem as we didn't write big programs, but they certainly weren't running fast, especially if you run them with a built-in BASIC interpreter. It is not surprising that I quickly learned assembler and spent lots of early years shifting bits and registers around. So did almost everybody else who wanted to release a commercial application written for one of those computers. There were, more or less, no games and applications written in BASIC simply because they would run too slow and nobody would use them.
Time has changed; computers are now fast—incredibly fast! If you don't believe me, check the code examples for this book. A lot of times, I had to write loops that spin over many million iterations so that the result of changing the code would be noticed at all. The raw speed of processors has also changed the software development world. Low-level languages such as assembler and C mostly gave way to more abstract approaches—C#, C++, Delphi, F#, Java, Python, Ruby, JavaScript, Go, and so on. The choice is yours. Almost anything you write in these languages runs fast or at least fast enough.
Computers are so fast that we sometimes forget the basic rule—performance matters. Customers like programs that operate so fast that they don't have to think about it. If they have to wait 10 seconds for a form to appear after clicking on a button, they won't be very happy. They'll probably still use the software, though, provided that it works for them and doesn't crash. On the other hand, if you write a data processing application that needs 26 hours for a job that executes daily, you'll certainly lose them.
I'm not saying that you should switch to assembler. Low-level languages are fast, but coding in them is too slow for modern times, and the probability of introducing bugs is just too high. High-level languages are just fine, but you have to know how to use them. You have to know what is fast and what not and—preferably—you should take this into account when designing the code.
This book will walk you through the different approaches that will help you write better code. Writing fast code is not the same as optimizing a few lines of your program to the extreme. Most of the time, that is in fact the completely wrong approach! However, I'm getting ahead of myself. Let the book speak for itself.
Who this book is for
This book was written for all Delphi programmers out there. You will find something interesting inside, whether you are new to programming or a seasoned old soul. I'm talking about basic stuff, about strings and arrays, lists and objects, but I'm also discussing parallel programming, memory manager internals, and object linking. There is also plenty of dictionaries, pointers, algorithmic complexities, code inlining, parameter passing, and what not.So, whoever you are, dear reader, I'm pretty sure you'll find something new in this book. Enjoy!
What this book covers
Chapter 1, About Performance, talks about performance. We'll dissect the term itself and try to find out what users actually mean when they say that a program is performing (or not performing) well. Then, we will move into the area of algorithm complexity. We'll skip all the boring mathematics and just mention the parts relevant to programming. We will also look at different ways of finding the slow (non-performant) parts of the program, from pure guesswork to measuring tools of a different sophistication, homemade and commercial.Chapter 2, Fixing the Algorithm, examines a few practical examples where changing an algorithm can speed up a program dramatically. In the first part, we'll look at graphical user interfaces and what we can do when a simple update to TListBox takes too long. The second part of the chapter explores the idea of caching and presents a reusable caching class with very fast implementation. In the last part, we'll revisit some code from Chapter 1, About Performance, and make it faster, again, by changing an algorithm.
--">- 1
- 2
- 3
- 4
- . . .
- последняя (106) »
Книги схожие с «Высокая производительность Delphi (черновик перевода глав 1-2)» по жанру, серии, автору или названию:
Александр Тарасович Гребёнкин - Танец на крыше Жанр: Рассказ Год издания: 2015 |