Overview
TeeChart provides multiple optimization strategies for handling large datasets, real-time updates, and high-performance visualization requirements. This guide covers advanced techniques including FastLine series, Ring Buffers, canvas selection, and rendering optimizations.Ring Buffer Series
What is a Ring Buffer?
A ring buffer (circular buffer) is a specialized data structure optimized for continuous data streams. When the buffer is full, new data overwrites the oldest values, creating a scrolling effect perfect for real-time monitoring. Source:VCL/RingBuffer/readme.md:5
The ring buffer is an array you can specify its type and length, and then just keep adding points to the buffer. When the buffer is full, points will be added from the start of the buffer again.
Creating Ring Buffer Series
Source:VCL/RingBuffer/readme.md:17
XY Ring Buffer
Source:VCL/RingBuffer/MainUnit.pas:100
Ring Buffer API
Source:VCL/RingBuffer/TeeRingBuffer.pas:60
Performance Characteristics
From:VCL/RingBuffer/TeeRingBuffer.pas:18
Advantages:
- Does not use typical XValues/YValues arrays (faster)
- Optimized memory allocation
- Constant-time append operation
- No memory reallocation during updates
- No 3D display support
- No null (missing) point values
- No stairs line mode
- Fixed buffer size
FastLine Series
Basic Usage
Source:FMX/Demo/Standard/DemoFastLine.pas:16
FastLine vs Line Series
| Feature | TLineSeries | TFastLineSeries |
|---|---|---|
| Speed | Moderate | Very Fast |
| Points/Lines | Lines with markers | Lines only |
| 3D Support | Full | Limited |
| Color per Point | Yes | No |
| Null Points | Yes | Limited |
| Best Use | < 1,000 points | > 1,000 points |
Optimizing FastLine
Canvas Selection
Performance Comparison
Source:VCL/RingBuffer/readme.md:32
Performance Rankings:Firemonkey (especially 64bit with RAD 13.0+) is faster than VCL.
- OpenGL canvas - Fastest for Windows/VCL (many lines and points)
- Skia canvas - Faster than GDI+
- GDI+ - Good quality, moderate speed
- Legacy GDI - Fast but lacks antialiasing (“jaggy” lines)
Enabling OpenGL Canvas
Source:VCL/RingBuffer/MainUnit.pas:69
Enabling Skia Canvas
Source:VCL/RingBuffer/MainUnit.pas:74
Canvas Configuration
Real-Time Updates
Idle Processing Pattern
Source:VCL/RingBuffer/MainUnit.pas:143
Timer-Based Updates
Horizontal Scrolling Optimization
Source:VCL/RingBuffer/readme.md:8
Horizontal scrolling is done by code as a speed optimization.
Batch Operations
Disable Auto-Repaint
Pre-Allocate Capacity
Bulk Data Loading
Memory Optimization
Series Memory Usage
Ring Buffer Memory
Free Unused Series
Drawing Optimizations
Reduce Visual Elements
Anti-Aliasing Trade-offs
Source:VCL/RingBuffer/MainUnit.pas:104
- Antialiasing ON: Better quality, slower (20-40% overhead)
- Antialiasing OFF: Maximum speed, aliased edges
Benchmarking
Measuring Render Time
Benchmark Loop
Source:VCL/RingBuffer/MainUnit.pas:44
Performance Tips Summary
1. Choose the Right Series Type
| Dataset Size | Recommended Series | Notes |
|---|---|---|
| < 1,000 | TLineSeries | Full features |
| 1K - 100K | TFastLineSeries | Good balance |
| > 100K | TRingBuffer | Best for streaming |
| Real-time | TRingBuffer | Optimal for continuous data |
2. Canvas Selection Priority
- OpenGL - Best for 3D and large datasets
- Skia - Best quality/performance balance
- GDI+ - Good for moderate datasets
- GDI - Legacy, avoid for new projects
3. Update Strategies
4. Axis Optimization
5. Memory Management
Expert Tips
Monitoring Performance
Progressive Loading
Thread-Safe Updates
See Also
- OpenGL Rendering - Hardware acceleration
- Custom Drawing - Canvas techniques
- Real-Time Data - High-performance data visualization
- FastLine Series
