CRC Press, Taylor & Francis Group, 2015. — xvi, 735 p. — ISBN13: 978-1-4822-1130-6.
The MatLAB programming environment is often perceived as a platform suitable for prototyping and modeling but not for "serious" applications. One of the main complaints is that MatLAB is just too slow.
Accelerating MatLAB Performance aims to correct this perception by describing multiple ways to greatly improve MatLAB program speed. Packed with thousands of helpful tips, it leaves no stone unturned, discussing every aspect of MatLAB.
Ideal for novices and professionals alike, the book describes MatLAB performance in a scale and depth never before published. It takes a comprehensive approach to MatLAB performance, illustrating numerous ways to attain the desired speedup.
The book covers MatLAB, CPU, and memory profiling and discusses various tradeoffs in performance tuning. It describes both the application of standard industry techniques in MatLAB, as well as methods that are specific to MatLAB such as using different data types or built-in functions.
The book covers MatLAB vectorization, parallelization (implicit and explicit), optimization, memory management, chunking, and caching. It explains MatLAB’s memory model and details how it can be leveraged. It describes the use of GPU, MEX, FPGA, and other forms of compiled code, as well as techniques for speeding up deployed applications. It details specific tips for MatLAB GUI, graphics, and I/O. It also reviews a wide variety of utilities, libraries, and toolboxes that can help to improve performance.
Sufficient information is provided to allow readers to immediately apply the suggestions to their own MatLAB programs. Extensive references are also included to allow those who wish to expand the treatment of a particular topic to do so easily.
Supported by an active website, and numerous code examples, the book will help readers rapidly attain significant reductions in development costs and program run times.
Introduction to Performance TuningWhy should we bother?
When to performance-tune and when not to bother
The iterative performance tuning cycle
What to tune
Performance tuning pitfalls
Performance tuning tradeoffs
Vertical vs. horizontal scaling
Perceived vs. actual performance
Profiling MatLAB PerformanceThe MatLAB Profiler
tic, toc and relatives
Timed log files and printouts
Non-MatLAB tools
Standard Performance-Tuning TechniquesLoop optimization
Data caching
Smart checks bypass
Exception handling
Improving externally-connected systems
Processing smaller data subsets
Interrupting long-running tasks
Latency vs. throughput
Data analysis
Other techniques
MatLAB-Specific TechniquesEffects of using different data types
Characters and strings
Using internal helper functions
Date and time functions
Numeric processing
Functional programming
Object-Oriented MatLAB
MatLAB startup
Additional techniques
Implicit Parallelization (Vectorization and Indexing)Introduction to MatLAB vectorization
Built-in vectorization functions
Simple vectorization examples
Repetitive data
Multi-dimensional data
Real-life example: Synthetic Aperture Radar matched filter
Effective use of MatLAB vectorization
Explicit Parallelization Using MathWorks ToolboxesThe Parallel Computing Toolbox – CPUs
The Parallel Computing Toolbox – GPUs
The MatLAB Distributed Computing Server
Techniques for effective parallelization in MatLAB
Explicit Parallelization by Other MeansGPU acceleration using Jacket
Alternative/related technologies
Multithreading
Spawning external processes
Using Compiled CodeUsing MEX code
Using the MatLAB Coder Toolbox
Porting MatLAB algorithms to FPGA
Deployed (compiled) MatLAB programs
Using external libraries
Memory-Related TechniquesWhy memory affects performance
Profiling memory usage
MatLAB’s memory storage and looping order
Array memory allocation
Minimizing memory allocations
Memory packing
Additional recommendations
Graphics and GUIInitial graphs generation
Updating graphs and images in real-time
Figure window performance aspects
GUI preparation and responsiveness
Avoiding common pitfalls
I/O TechniquesReducing the amount of I/O
Avoiding repeated file access
Reading and writing files
Data compression and the save function
Excel files (and Microsoft Office files in general)
Image files
Using Java and C I/O
Searching, parsing and comparing files
Additional aspects
Additional ResourcesOnline resources
Books
Performance-related official MatLAB bugs
Performance-related Code Analyzer (MLint) warnings
Performance Tuning Checklist