High-performance virtual tree control for Delphi / RAD Studio. This fork includes deep code audit, critical bug fixes, performance optimizations, and modernization.
Supported: RAD Studio 10.4 Sydney and higher (Delphi & C++ Builder) License: MPL 1.1 / LGPL 2.1 with static linking exception
- Fixed infinite recursion in
GetSystemMetrics(FMX) - Fixed race condition in worker thread singleton
- Fixed HTML/RTF injection in export (XSS prevention)
- Fixed pixel offset in
bmMasterAlphaalpha blending - Fixed
TThread.Queueuse-after-free in validation - Fixed
GlobalAllocnull-check (5 locations) - Fixed
StgMediumIncRefstale data on error - Replaced
Sleep(1)busy-wait withMsgWaitForMultipleObjects
- Theme handle caching (eliminates
OpenThemeData/CloseThemeDataper cell) - Node bitmap reuse (eliminates
TBitmap.Create/Freeper paint cycle) - SSE2: 2 pixels per iteration in
bmConstantAlpha(~2x speedup on x64) SystemParametersInfocaching in mouse wheel handler- ScrollBar bitmap caching in style hooks
- O(n) format array growth instead of O(n^2)
- Iterative
DeleteChildren(no stack overflow at depth 10,000+) - Free-list node recycling (reuse freed memory blocks)
- Non-blocking
Animate(UI responsive during expand/collapse) HandleHotTrackearly-exit when hot tracking disabled- Font cache (
FFontCacheValid) skips redundantCanvas.Font.Assign
- Extracted methods from 800-line
WMKeyDown, 600-linePaintTree, 480-lineHandleMessage - Unified duplicate
MergeAscending/MergeDescendinginto singleMergeNodes - Replaced
TWriterHackwithSystem.Rtti - Eliminated dangerous
withblocks (11 instances) - Added
constto 22 methods withTPoint/TRectparameters
- MMX replaced with SSE2 in all 32-bit alpha blending (removed EMMS)
- Fixed pre-existing SSE2 alpha extraction bug (
PUNPCKHWD->PSHUFLW) TList->TObjectList<T>in clipboard withOwnsObjects- DPI-aware
DrawExpandArrowwithScaledPixels AnsiQuotedStr->string.QuotedString- Enum validation on stream load (13 points)
- GUID string literals,
DupeString, inline getters, scoped{$WARN} Screen.PixelsPerInch->CurrentPPIfor per-monitor DPI
TVirtualNodecache-line optimization: hot fields in first 48 bytes,{$ALIGN 8}, sameSizeOfTVirtualDrawTreealigned withTVirtualStringTree(+11 published properties)- Typed column enumerator (
for Col in Columns do)
- 84 tests (77 functional + 7 benchmarks), all passing
- Covers: accessibility, threading, export, rendering, sorting, keyboard, streaming, SSE2, selection, hot tracking, animation, font cache
- QPC-based benchmarks with microsecond precision
See INSTALL.txt for step-by-step instructions.
Quick start:
- Open
Packages\RAD Studio 10.4+\VirtualTreeView.groupproj - Build All
- Install
VirtualTreesD*.bpl - Add library paths for Win32 and Win64
| Operation | Time | Notes |
|---|---|---|
| Create 100K nodes | ~28 ms | With free-list recycling |
| Delete 5K deep tree | ~50 ms | Iterative post-order traversal |
| Sort 50K nodes | ~21 ms | MergeSort |
| Paint 500 nodes x 5 cols | ~14 ms | Full pipeline with font/theme cache |
| RTF Export 10K nodes | ~11 ms | With DupeString tabs |
| SelectAll 10K nodes | ~10 ms | NativeUInt-sorted selection |
| Free-list recycle 10K | ~12 ms | Add/Delete/Add cycle |
Source/ - 25 core library units
Design/ - Design-time IDE registration
Packages/ - Build packages (RAD Studio 10.4+, C++ Builder 10.4-12)
Tests/Aggressive - 84 automated tests + benchmarks
Demos/ - Example applications
Doc/ - Documentation, audit report, progress tracking
Help/ - CHM help file and source
Resources/ - Bitmaps, cursors, icons
Original authors: Mike Lischke (creator), JAM Software (maintainer since 2014) Optimization & modernization: Platon (2026) - deep audit, 130+ findings, 84 tests
Original repository: JAM-Software/Virtual-TreeView
Virtual Treeview is published under a double license:
- Mozilla Public License 1.1
- LGPL 2.1 with static linking exception
Высокопроизводительный виртуальный tree-контрол для Delphi / RAD Studio. Этот форк включает глубокий аудит кода, исправление критических багов, оптимизацию производительности и модернизацию.
Поддержка: RAD Studio 10.4 Sydney и выше (Delphi & C++ Builder) Лицензия: MPL 1.1 / LGPL 2.1 с исключением для статической линковки
- Исправлена бесконечная рекурсия в
GetSystemMetrics(FMX) - Исправлена гонка (race condition) в singleton worker thread
- Исправлена HTML/RTF-инъекция в экспорте (предотвращение XSS)
- Исправлено смещение пикселей в
bmMasterAlpha - Исправлен use-after-free в
TThread.Queueпри валидации - Добавлена проверка
GlobalAllocна null (5 мест) - Исправлен
StgMediumIncRef— очистка stale data при ошибке - Заменён
Sleep(1)busy-wait наMsgWaitForMultipleObjects
- Кэширование theme handles (убраны
OpenThemeData/CloseThemeDataна каждую ячейку) - Переиспользование Node bitmap (убрано создание
TBitmapна каждый paint) - SSE2: 2 пикселя за итерацию в
bmConstantAlpha(~2x ускорение на x64) - Кэширование
SystemParametersInfoпри обработке колеса мыши - Кэширование ScrollBar bitmap в style hooks
- Рост массива форматов O(n) вместо O(n^2)
- Итеративный
DeleteChildren(без переполнения стека на глубине 10,000+) - Free-list рециклинг узлов (повторное использование освобождённой памяти)
- Неблокирующая анимация
Animate(UI отзывчив при expand/collapse) - Early-exit в
HandleHotTrackпри отключённом hot tracking - Кэш шрифтов (
FFontCacheValid) — пропуск лишнихCanvas.Font.Assign
- Извлечены методы из 800-строчного
WMKeyDown, 600-строчногоPaintTree, 480-строчногоHandleMessage - Объединены дубликаты
MergeAscending/MergeDescendingв единыйMergeNodes TWriterHackзаменён наSystem.Rtti- Устранены опасные блоки
with(11 экземпляров) - Добавлен
constк 22 методам с параметрамиTPoint/TRect
- MMX заменён на SSE2 во всех 32-битных функциях alpha blending (убран EMMS)
- Исправлен pre-existing баг SSE2 извлечения альфы (
PUNPCKHWD->PSHUFLW) TList->TObjectList<T>в clipboard сOwnsObjects- DPI-aware
DrawExpandArrowсScaledPixels AnsiQuotedStr->string.QuotedString- Валидация enum при загрузке из потока (13 точек)
- GUID строковые литералы,
DupeString, inline getters, scoped{$WARN} Screen.PixelsPerInch->CurrentPPIдля per-monitor DPI
- Оптимизация
TVirtualNodeдля cache-line: горячие поля в первых 48 байтах,{$ALIGN 8}, без измененияSizeOf TVirtualDrawTreeвыровнен сTVirtualStringTree(+11 published свойств)- Типизированный enumerator для колонок (
for Col in Columns do)
- 84 теста (77 функциональных + 7 бенчмарков), все проходят
- Покрытие: accessibility, threading, export, rendering, sorting, keyboard, streaming, SSE2, selection, hot tracking, animation, font cache
- QPC-бенчмарки с микросекундной точностью
См. INSTALL.txt для пошаговой инструкции.
Быстрый старт:
- Откройте
Packages\RAD Studio 10.4+\VirtualTreeView.groupproj - Build All
- Install
VirtualTreesD*.bpl - Добавьте library paths для Win32 и Win64
Оригинальные авторы: Mike Lischke (создатель), JAM Software (сопровождение с 2014) Оптимизация и модернизация: Platon (2026) - глубокий аудит, 130+ находок, 84 теста
Оригинальный репозиторий: JAM-Software/Virtual-TreeView
Virtual Treeview опубликован под двойной лицензией:
- Mozilla Public License 1.1
- LGPL 2.1 с исключением для статической линковки