Products Technologies Demo Docs Blog Support Company

TX Text Control Core vs. Classic Performance Comparison Plain Text to DOCX and PDF

In this article, we compare the performance of TX Text Control Core and Classic when converting plain text to DOCX and PDF. The results show that TX Text Control Core outperforms Classic in both scenarios.

TX Text Control Core vs. Classic Performance Comparison Plain Text to DOCX and PDF

In this post, we'll take a look at a performance comparison between the new TX Text Control Core and the traditional TX Text Control Classic. We'll examine how both versions perform under increasing workloads, specifically measuring the time it takes to load a plain text document and export it to DOCX and PDF formats.

Test Setup

We designed a simple benchmark to simulate real-world use. Every test:

  • Generates a text file containing a variable number of lines (100, 500, 5,000, 50,000, and 100,000)
  • Loads the content into a ServerTextControl instance
  • Exports the content to either PDF or DOCX format
  • Measures the elapsed time in milliseconds

Each test run was performed using both the Classic and Core libraries.

using System.Diagnostics;
using System.Text;
using TXTextControl;

// Define the line counts to test
int[] lineCounts = new int[] { 100, 100, 500, 5000, 50000, 100000 };

foreach (int lineCount in lineCounts)
{
    Console.WriteLine($"--- Testing with {lineCount} lines ---");

    string longText = GenerateLongText(lineCount);
    Stopwatch sw = new Stopwatch();
    int numPages;

    sw.Start();

    using (ServerTextControl textControl = new ServerTextControl())
    {
        textControl.Create();
        textControl.Load(longText, StringStreamType.PlainText);

        byte[] data;
        textControl.Save(out data, BinaryStreamType.WordprocessingML);
        //textControl.Save(out data, BinaryStreamType.AdobePDF);

        numPages = textControl.Pages;
    }

    sw.Stop();

    Console.WriteLine($"Lines: {lineCount}");
    Console.WriteLine($"Time: {sw.ElapsedMilliseconds} ms");
    Console.WriteLine($"Pages: {numPages}");
    Console.WriteLine();
}

static string GenerateLongText(int numberOfLines)
{
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < numberOfLines; i++)
    {
        sb.AppendLine(Guid.NewGuid().ToString());
    }
    return sb.ToString();
}

Test Results

The results of our tests are summarized in the following table:

Lines Core (DOCX) Core (PDF) Classic (DOCX) Classic (PDF)
100 11 ms 23 ms 51 ms 214 ms
500 19 ms 76 ms 72 ms 839 ms
5,000 113 ms 684 ms 289 ms 7,842 ms
50,000 1,271 ms 6,957 ms 2,697 ms 78,921 ms
100,000 3,047 ms 14,518 ms 5,885 ms 159,313 ms

To give you an idea of document size, 100,000 lines of text results in a 1588-page document. The following visualizations will show you the differences in a much more obvious way.

Creating DOCX Core vs. Classic

Creating PDF Core vs. Classic

TX Text Control Core significantly outperforms the Classic version when exporting to DOCX. Core is consistently 2 to 5 times faster than Classic. The performance gap increases with document size, an indication of better scalability in the core.

When exporting to PDF, the performance difference is even more pronounced. Core is up to 11 times faster than Classic, depending on the document size. Core scales linearly, while Classic incurs growing overhead at larger sizes.

Linear Scaling

Performance is very close to linear, with a slightly steeper curve as the document grows. TX Text Control Core is designed for high performance and scalability. The results show that the Core library scales almost linearly with document size, while the performance of the Classic library degrades significantly with larger documents.

In conclusion, if you are looking for a library that can handle large documents efficiently, TX Text Control Core is the clear choice. It outperforms the Classic version in both DOCX and PDF exports, making it the better option for modern applications.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

ASP.NETASP.NET CoreDOCX

Convert MS Word DOCX to PDF including Text Reflow using .NET C# on Linux

This article explains how to use TX Text Control .NET Server to convert a Microsoft Word DOCX document to a PDF file on a Linux system using .NET C#. This conversion process includes text reflow,…


ASP.NETASP.NET CoreDocker

Announcing the Official DS Server Docker Image on Docker Hub

The official DS Server Docker image is now available on Docker Hub. This makes it easier to deploy the DS server in a containerized environment and manage and scale your applications. Based on the…


ASP.NETASP.NET CoreDS Server

Introducing DS Server 4.0: Linux-Ready and Container-Friendly

We are excited to announce the release of DS Server 4.0, our latest major update that makes your document processing workflows more flexible and powerful. This release marks two significant…


ASP.NETASP.NET CoreLinux

Creating a .NET Console Application with Visual Studio Code and TX Text…

This article describes how to create a .NET console application using Visual Studio Code and TX Text Control on Linux. It covers installing the .NET SDK, creating a new project, and adding TX Text…


ASP.NETASP.NET CoreLinux

How to Create PDF Documents with TX Text Control using C# .NET on Linux

This article shows how to create professional PDF and PDF/A documents using ASP.NET Core C# on Linux. TX Text Control enables the creation of pixel-perfect PDF documents on any Linux environment…