
Delphi High Performance
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
Discover algorithm performance, high- and low-level optimizations, and the internal behavior of programs written in the Delphi language
Purchase of the print or Kindle book includes a free PDF eBook
Key Features
Discover external programming libraries that will speed up your programming and code
Learn to integrate external libraries into Delphi programs
Build fast Delphi applications using concurrency, parallel programming, and memory management
Book Description
Performance matters! Users hate to use programs that are not responsive to interactions or run too slow to be useful. While becoming a programmer is simple enough, you require dedication and hard work to achieve an advanced level of programming proficiency where you know how to write fast code.
This book begins by helping you explore algorithms and algorithmic complexity and continues by describing tools that can help you find slow parts of your code. Subsequent chapters will provide you with practical ideas about optimizing code by doing less work or doing it in a smarter way. The book also teaches you how to use optimized data structures from the Spring4D library, along with exploring data structures that are not part of the standard Delphi runtime library.
The second part of the book talks about parallel programming. You'll learn about the problems that only occur in multithreaded code and explore various approaches to fixing them effectively. The concluding chapters provide instructions on writing parallel code in different ways - by using basic threading support or focusing on advanced concepts such as tasks and parallel patterns.
By the end of this book, you'll have learned to look at your programs from a totally different perspective and will be equipped to effortlessly make your code faster than it is now.
What you will learn
Get to grips with algorithmic complexity and learn how to recognize it
Use tools to determine program runtime behavior
Speed up programs by doing less instead of more
Discover the internal workings of Delphi data structures
Gain an understanding of Delphi's memory manager
Find out how to write low-level parallel programs with TThread
Use parallel patterns from the PPL and OTL libraries to write fast code
Include external code, written in C or C++, in Delphi programs
Who this book is for
This book is for all Delphi programmers. Whether you're a beginner or an accomplished programmer, you will find something interesting. Even though the focus is on the latest Delphi release, the code uses only standard Delphi syntax without syntactic additions from the latest releases, and most of it should compile and run in any Delphi from XE7 onward. If you're using an older version of Delphi, don't despair! Most of the concepts in this book do not depend on a specific Delphi version and will be useful for everyone.
All prices
More details
Other editions
Additional editions

Previous edition

Content
- Cover
- Title Page
- Copyright and Credits
- Contributors
- Table of Contents
- Preface
- Chapter 1: About Performance
- Technical requirements
- 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 Big O eyes
- Summary
- Chapter 2: Profiling the Code
- Technical requirements
- Don't guess, measure!
- Profiling with TStopwatch
- Profilers
- Summary
- Chapter .3: Fixing the Algorithm
- Technical requirements
- Writing responsive user interfaces
- Updating a progress bar
- Bulk updates
- Virtual display
- Caching
- Memoization
- Dynamic cache
- Speeding up SlowCode
- Summary
- Chapter 4: Don't Reinvent, Reuse
- Technical requirements
- Spring for Delphi
- Enumerations, collections, and lists
- IEnumerable&T&
- ICollection&T&
- IList&T&
- Other interfaces
- TEnumerable
- Stacks and queues
- Trees
- Red-black trees
- Sets and dictionaries
- ISet&T&
- IMultiSet&T&
- IDictionary&TKey, TValue&
- IBiDiDictionary&TKey, TValue&
- Summary
- Chapter 5: Fine-Tuning the Code
- Technical requirements
- 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
- Chapter 6: Memory Management
- Technical requirements
- Optimizing strings and array allocations
- Memory management functions
- Dynamic record allocation
- FastMM4 internals
- Memory allocation in a parallel world
- Replacing the default memory manager
- Logging memory manager
- FastMM4 with release stack
- FastMM5
- TBBMalloc
- Comparing memory managers
- There is no silver bullet
- Fine-tuning SlowCode
- Summary
- Chapter 7: Getting Started with the Parallel World
- Technical requirements
- Processes and threads
- Multithreading
- Multitasking
- When to parallelize code
- The most common problems
- Never access the UI from a background thread
- Simultaneous reading and writing
- Sharing a variable
- Hidden behavior
- 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
- Chapter 8: Working with Parallel Tools
- Technical requirements
- TThread
- Automatic life cycle management
- Advanced TThread
- Setting up a communication channel
- Sending messages from a thread
- Using TCommThread
- Implementing a timer
- Synchronizing with multiple workers
- WaitForMultipleObjects
- Condition variables
- Comparing both approaches
- Summary
- Chapter 9: Exploring Parallel Practices
- Technical requirements
- Tasks and patterns
- Variable capturing
- Tasks
- Exceptions in tasks
- Parallelizing a loop
- Thread pooling
- Async/Await
- Join
- Join/Await
- Future
- Parallel for
- Pipelines
- Web spider
- The filter stage
- The downloader stage
- The parser stage
- Summary
- Chapter 10: More Parallel Patterns
- Technical requirements
- Using OmniThreadLibrary
- Blocking collections
- Using blocking collections with TThread-based threads
- Async/Await
- Join
- Future
- Parallel Task
- Background Worker
- Initial query
- Pipeline
- Creating the pipeline
- Stages
- Displaying the result and shutting down
- Map
- Timed Task
- Summary
- Chapter 11: Using External Libraries
- Technical requirements
- Linking with object files
- Object file formats
- Object file linking in practice
- Using C++ libraries
- Writing exported functions
- Using a proxy DLL in Delphi
- Summary
- Chapter 12: Best Practices
- About performance
- Profiling the code
- Fixing the algorithm
- Don't reinvent, reuse
- Fine-tuning the code
- Memory management
- Getting started with the parallel world
- Working with parallel tools
- Exploring parallel practices
- More parallel patterns
- Using external libraries
- Final words
- Index
- Other Books You May Enjoy
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.
File format: ePUB
Copy protection: without DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use a reader that can handle the file format ePUB, such as Adobe Digital Editions or FBReader – both free (see eBook Help).
- Tablet/Smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePUB works well for novels and non-fiction books – i.e., 'flowing' text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook does not use copy protection or Digital Rights Management
For more information, see our eBook Help page.