﻿{"id":1508,"date":"2026-10-22T14:39:59","date_gmt":"2026-10-22T06:39:59","guid":{"rendered":"https:\/\/www.nsecsoft.com\/en\/?p=1508"},"modified":"2026-10-22T14:39:59","modified_gmt":"2026-10-22T06:39:59","slug":"performance-enhancement","status":"publish","type":"post","link":"https:\/\/www.nsecsoft.com\/en\/default\/performance-enhancement.html","title":{"rendered":"Refactoring the Document Processing Engine: Better Performance, Lower Resource Overhead"},"content":{"rendered":"<p>Document text extraction is a foundational capability for data security analysis. Its processing efficiency and resource usage directly affect the cost of associated tasks. As document-processing requirements grow, engine optimization must address content completeness, processing latency, and computational demand together, with benefits verified under consistent measurement conditions.<\/p>\n<p>The document processing engine refactoring targets shorter processing times, lower CPU cost, and lower per-task peak memory usage. The performance evaluation compares the refactored implementation, the previous implementation, and Apache Tika using the same document set, covering DOCX, XLSX, PPTX, and PDF.<\/p>\n<p>Under <strong>a separate process per document, including startup and initialization costs<\/strong>, the refactored implementation reduced cumulative elapsed time by approximately <strong>93.0%<\/strong>, cumulative CPU time by <strong>94.3%<\/strong>, and the maximum single-task peak working set per round by <strong>67.7%<\/strong>, relative to the previous implementation. These reductions apply to the tested workload and measurement model, not to whole-system resource consumption or every deployment scenario.<\/p>\n<h4><strong>Performance gains<\/strong><\/h4>\n<p>The test set contains 12 generated documents, with three sizes per format. Each implementation completed six measured rounds. The table reports the median across those rounds.<\/p>\n<div class=\"ds-scroll-area ds-scroll-area--show-on-focus-within ds-scroll-area--enabled _1210dd7 c03cafe9\">\n<div class=\"ds-scroll-area__gutters\">\n<div class=\"ds-scroll-area__gutters\">\n<div class=\"ds-scroll-area__vertical-gutter\">\n<table>\n<thead>\n<tr>\n<th><span class=\"\">Metric<\/span><\/th>\n<th><span class=\"\">Refactored implementation<\/span><\/th>\n<th><span class=\"\">Previous implementation<\/span><\/th>\n<th><span class=\"\">Apache Tika 3.3.0<\/span><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span class=\"\">Cumulative elapsed time for 12 tasks<\/span><\/td>\n<td><span class=\"\"><strong>0.724 s<\/strong><\/span><\/td>\n<td><span class=\"\">10.326 s<\/span><\/td>\n<td><span class=\"\">14.528 s<\/span><\/td>\n<\/tr>\n<tr>\n<td><span class=\"\">Cumulative CPU time for 12 tasks<\/span><\/td>\n<td><span class=\"\"><strong>0.570 s<\/strong><\/span><\/td>\n<td><span class=\"\">9.930 s<\/span><\/td>\n<td><span class=\"\">46.250 s<\/span><\/td>\n<\/tr>\n<tr>\n<td><span class=\"\">Maximum single-task peak working set per round<\/span><\/td>\n<td><span class=\"\"><strong>36.18 MiB<\/strong><\/span><\/td>\n<td><span class=\"\">111.90 MiB<\/span><\/td>\n<td><span class=\"\">320.15 MiB<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Elapsed time and CPU time are summed separately over the 12 tasks in each round. The memory metric takes the highest single-task peak in each round, followed by the median over six rounds; <strong>memory usage is not added across tasks<\/strong>. The elapsed-time totals consist of independent tasks executed in rotating order, not a throughput measurement of continuous processing in a persistent service.<\/p>\n<p>Relative to Apache Tika in this test configuration, the corresponding reductions were approximately <strong>95.0%, 98.8%, and 88.7%<\/strong>. Apache Tika serves only as an external reference. These results do not evaluate other versions or deployment configurations.<\/p>\n<h4><strong>Document processing time<\/strong><\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26815\" src=\"https:\/\/www.nsecsoft.com\/wp-content\/uploads\/2026\/10\/latency-curves.png\" alt=\"Ping64,Elapsed time per task for three implementations across four formats and three document sizes\" width=\"800\" height=\"570\" \/><\/p>\n<p>For all 12 test inputs, the refactored implementation recorded a lower median elapsed time per task than either reference. This demonstrates shorter processing wait times under the short-lived task model used in this evaluation.<\/p>\n<p>The improvement varies by format. The previous implementation had comparatively low elapsed times for presentations, while its PDF elapsed times grew more noticeably as page count increased within this set. The best result for a single format is therefore insufficient to characterize every document.<\/p>\n<p>The measurement includes initialization, text extraction, and result output. Their individual contributions were not measured separately, so the total improvement cannot be attributed to a specific stage or technology choice.<\/p>\n<h4><strong>CPU cost<\/strong><\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-26816\" src=\"https:\/\/www.nsecsoft.com\/wp-content\/uploads\/2026\/10\/cpu-time-curves.png\" alt=\"Ping64,Cumulative CPU time per task for three implementations across four formats and three document sizes\" width=\"800\" height=\"570\" \/><\/p>\n<p>Processing latency and computational cost are distinct metrics. Parallel execution can reduce elapsed time while increasing cumulative CPU time; both were therefore recorded.<\/p>\n<p>For the same set of 12 tasks, median cumulative CPU time decreased from <strong>9.930 s<\/strong> for the previous implementation to <strong>0.570 s<\/strong> for the refactored implementation. This supports a reduction in cumulative computation for the tested workload.<\/p>\n<p><strong>CPU time is not whole-system CPU utilization<\/strong> and cannot be converted directly into energy consumption or battery-life changes. Whole-system utilization, energy use, and battery life were not measured, and no corresponding inference is made.<\/p>\n<h4><strong>Per-task peak memory<\/strong><\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26817\" src=\"https:\/\/www.nsecsoft.com\/wp-content\/uploads\/2026\/10\/memory-curves.png\" alt=\"Ping64,Peak working set per task for three implementations across four formats and three document sizes\" width=\"800\" height=\"570\" \/><\/p>\n<p>The median of the maximum single-task peak working set per round decreased from <strong>111.90 MiB<\/strong> for the previous implementation to <strong>36.18 MiB<\/strong> for the refactored implementation. This metric is the largest resident working set recorded by the operating system for a process. It includes the runtime environment and shared resident pages and is not equivalent to private memory or whole-system memory usage.<\/p>\n<p>Memory growth differs by format. It was more pronounced for the spreadsheets in this set than for the presentations, indicating that resource budgets must account for format and content size. Small-file results cannot be extrapolated directly to large-file behavior.<\/p>\n<p>Lower single-task peaks provide evidence for reducing the resource requirements of document tasks, but do not imply that concurrency can increase proportionally. Concurrent workloads involve overlapping peaks, shared pages, and caches and require independent measurement.<\/p>\n<h4><strong>Test conditions and result validation<\/strong><\/h4>\n<p>Testing took place on 20 October 2026 on the same Windows workstation. All three test processes were verified as x64.<\/p>\n<div class=\"ds-scroll-area ds-scroll-area--show-on-focus-within ds-scroll-area--enabled _1210dd7 c03cafe9\">\n<div class=\"ds-scroll-area__vertical-gutter\">\n<table>\n<thead>\n<tr>\n<th><span class=\"\">Test condition<\/span><\/th>\n<th><span class=\"\">Configuration<\/span><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span class=\"\">Processor<\/span><\/td>\n<td><span class=\"\">Intel Core i7-12700; 12 cores, 20 logical processors<\/span><\/td>\n<\/tr>\n<tr>\n<td><span class=\"\">Operating system and memory<\/span><\/td>\n<td><span class=\"\">Windows 11 Pro, build 26300; approximately 127.7 GiB of system-visible memory<\/span><\/td>\n<\/tr>\n<tr>\n<td><span class=\"\">Runtime settings<\/span><\/td>\n<td><span class=\"\">Balanced power plan; no processor-affinity changes; background applications left running<\/span><\/td>\n<\/tr>\n<tr>\n<td><span class=\"\">External reference<\/span><\/td>\n<td><span class=\"\">Apache Tika 3.3.0; Java 18.0.2 with a 1 GiB maximum heap; direct parser API calls, without starting an HTTP service<\/span><\/td>\n<\/tr>\n<tr>\n<td><span class=\"\">Measurement scope<\/span><\/td>\n<td><span class=\"\">A fresh process per document; includes startup, initialization, text extraction, result output, and exit; excludes subsequent validation and scheduling by the test controller<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>The input sizes were 100, 1,000, and 5,000 paragraphs for DOCX; 100, 1,000, and 5,000 rows with six columns per row for XLSX; 5, 50, and 200 slides with 10 paragraphs per slide for PPTX; and 5, 50, and 200 pages with 35 lines per page for PDF. All implementations read identical inputs, with file hashes unchanged before and after testing.<\/p>\n<p>Each document\u2013implementation combination received one warm-up followed by six measured executions, all using fresh processes. Inputs were pre-read without clearing the operating-system file cache. The six rounds covered all six implementation orders, with document order reshuffled using a fixed seed. There were <strong>216 measured executions<\/strong>, plus 36 warm-ups excluded from the statistics. No slow measured executions were discarded.<\/p>\n<p>Each execution checked the success status and compared all alphanumeric body-text tokens in order. Differences in the inclusion of worksheet names were registered before testing and were not treated as body-text differences. <strong>All 216 measured executions passed this check<\/strong>; failures, empty text, or missing body content were not counted as faster results. The check does not compare whitespace layout and does not establish behavioral equivalence for complex documents.<\/p>\n<p>CPU time is the sum of process user-mode and kernel-mode time and may exceed elapsed time under multithreading. On this machine, readings advanced in approximately 15.6 ms steps; a zero reading for a short task does not imply zero computation. Memory uses the system-maintained peak-working-set counter rather than estimating the peak solely from periodic samples.<\/p>\n<p>The curves show the median and minimum\u2013maximum range of six runs. Error bars are not confidence intervals, and connecting lines do not extrapolate to unmeasured sizes. Reductions use unrounded medians and the formula \u201c1 \u2212 refactored value \u00f7 reference value.\u201d Reductions in different metrics cannot be added or combined into an overall performance-improvement percentage.<\/p>\n<h4><strong>Scope of the results<\/strong><\/h4>\n<p>These results establish elapsed-time, CPU-time, and per-task peak-memory benefits for the tested workload. The separate-process test includes initialization costs, which persistent services can amortize. The reported reductions therefore cannot directly predict persistent-service request latency, parsing speed after warm-up, or sustained throughput.<\/p>\n<p>The samples are generated ASCII-text documents without images, formulas, macros, external resources, or embedded attachments and do not represent the distribution of actual enterprise documents. Legacy formats, Chinese text and complex encodings, unusual fonts, complex tracked changes, encrypted or damaged documents, and PDF watermarking results require separate verification. This evaluation is not a claim of complete behavioral alignment.<\/p>\n<p>Testing covers one workstation and six measured executions per combination, not a cross-hardware or cross-platform performance guarantee. The figures come from an internal NSecsoft benchmark, not independent third-party certification.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Document text extraction is a foundational capability f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1170,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1508","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-default"],"_links":{"self":[{"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/posts\/1508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/comments?post=1508"}],"version-history":[{"count":2,"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/posts\/1508\/revisions"}],"predecessor-version":[{"id":1510,"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/posts\/1508\/revisions\/1510"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/media\/1170"}],"wp:attachment":[{"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/media?parent=1508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/categories?post=1508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsecsoft.com\/en\/wp-json\/wp\/v2\/tags?post=1508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}