-
Notifications
You must be signed in to change notification settings - Fork 1
Time Complexity Analysis
Sinbad Adjuik edited this page Apr 6, 2026
·
3 revisions
The Cetamura Batch Ingest Tool performs recursive discovery, metadata parsing, packaging, and validation for two workflows:
PhotoPatent
Overall runtime remains dominated by file discovery and asset processing.
- recursive scan of candidate files:
O(N) - grouping and validation of discovered sets:
O(N)
Where:
-
N= number of files scanned under the selected root
Per matched asset:
- XML parsing:
O(X) - image decode and TIFF conversion:
O(M) - ZIP creation:
O(M)
Where:
-
X= XML size -
M= image size / pixel work
For P photo assets, the dominant runtime is:
O(P * M)
- ZIP enumeration and structure checks:
O(Z) - reconciliation against CSV rows:
O(Z + C)
Where:
-
Z= ZIP count -
C= CSV row count
- recursive scan for patent XML, PDF, and manifest files:
O(N)
Per patent record:
- XML parsing and identifier checks:
O(X) - local PDF match lookup:
O(L) - fallback PDF index lookup:
O(1)average after index build - ZIP creation:
O(F)
Where:
-
X= XML size -
L= local PDF candidates in the batch directory -
F= file copy/compression work for one PDF, one XML, and one manifest
If fallback roots are used:
- fallback PDF index build:
O(R)
Where:
-
R= number of PDFs scanned across configured fallback roots
Total patent processing is typically:
O(N + R + P)
for normal packaging workloads, with ZIP I/O dominating in practice.
Typical memory use is bounded by:
- discovery metadata structures:
O(N) - one working asset at a time during packaging
- temporary output-side scratch space for photo workflow only
The design remains memory-efficient because packaging is sequential and source files are not duplicated in memory beyond the current item being processed.
In real runs, the major cost is usually not the Python control flow. It is:
- disk I/O
- TIFF conversion for photo assets
- recursive fallback PDF indexing when patent fallback roots are large
- photo workflow is dominated by image processing and behaves roughly like
O(P * M) - patent workflow is dominated by recursive discovery plus ZIP I/O and behaves roughly like
O(N + R + P) - validation overhead is linear and small relative to packaging work
Last updated: April 6, 2026