TX Text Control .NET for WPF

Performance

Topic

A WPF window freezes whenever its dispatcher is busy, and loading, converting and merging documents can keep it busy for seconds or minutes. Developers who build editors, report generators or batch tools with TX Text Control .NET for WPF find here how its classes fit the threading model of WPF, how to move long work to other threads and processes, how to handle large documents and memory, and which of Text Control's measurements back each recommendation.

The Editor and the Engine Without a Window

Two classes hold documents, and they belong to different threads:

WPF TextControlServerTextControl
Used forThe document the user sees and editsDocuments your code creates, converts, merges or prints
ThreadThe UI thread of its window, reached through its DispatcherAny thread, one instance per thread
Undo buffer and screen renderingYesNo
DisposalNot disposable; it lives as long as its windowDisposed by your code, in a using block

Load, Save and the merge methods of MailMerge are synchronous and occupy the thread that calls them. Work that takes longer than a moment therefore runs in a ServerTextControl on a thread of the thread pool, and only the result goes back to the editor. TX Text Control is thread safe, but its threads can wait for each other, which is why Text Control recommends separate processes for very large batches.

Find the Right Page

If you want toRead
Understand which objects belong to the UI thread and get results back to the editorDispatcher and UI Thread Access
Convert or process many files on other threads, with progress and a cancel buttonBackground Operations
Build and process documents with hundreds of pagesLarge Documents
Dispose instances, find leaks and stay below the handle limits of WindowsMemory Usage and Resource Disposal
Choose the format documents are kept in and load only what a task needsDocument Loading and Conversion
Know what a merge costs, merge in the background and in separate processesMail Merge Performance
See every measure at a glance and measure your own documentsPerformance Best Practices