TX Text Control .NET for Windows Forms

Performance

Topic

Users judge a Windows Forms application by whether its form responds, and TX Text Control applications are no exception: the form should stay usable while a report is merged, a folder is converted or a long contract is opened. Read on for how to keep document work away from the UI thread, handle large documents and many files, release what TX Text Control holds, and what Text Control's own measurements say about each of these.

Two Classes, Two Kinds of Work

The work of a TX Text Control application falls into two kinds, and each has its own class:

TextControlServerTextControl
Used forThe document the user sees and editsDocuments your code creates, converts, merges or prints
ThreadThe UI thread of the formAny thread, one instance per thread
Undo buffer and screen renderingYesNo
Released whenThe form is closedYour code disposes it

Load, Save and the merge methods of MailMerge are synchronous, so the thread that calls them is busy until they return. Everything that takes longer than a moment belongs in a ServerTextControl on a background thread. TX Text Control is thread safe, but threads can wait for each other inside it, and for large batches Text Control recommends several processes instead of several threads.

Find the Right Page

If you want toRead
Keep the form responsive, report progress, cancel work and update the editor from other threadsUI Threading and Background Operations
Build, insert and process documents with hundreds of pagesLarge Documents
Dispose instances, find those that are left behind and understand the handle limit of WindowsMemory Usage and Resource Disposal
Load and convert many documents, and choose the format to keep them inDocument Loading and Conversion
Know what a merge costs, merge in the background and merge large batches in processesMail Merge Performance
See all measures at a glance, set a default formatting printer and measure your own workloadPerformance Best Practices

Where to Start

  1. Performance Best Practices lists every measure with its effect and links the page that shows the code.
  2. UI Threading and Background Operations gives the rules that every background task in a Windows Forms application follows.
  3. Memory Usage and Resource Disposal before your application runs for hours or days.

The numbers on these pages come from benchmarks that Text Control has published, most of them measured with TX Text Control .NET Server. Each one is given with its conditions, and none replaces a measurement with your own documents.