We tested the parsing and validation speed (using .NET Stopwatch) and memory allocation of the .NET Core 3.1 version of EDI Tools for .NET.
Prerequisites
-
Configure the Template for splitting
We did two tests for parsing and validation of the large file - with and without splitting. Following the steps in the Parsing large EDI files article, the [Splitter] attribute was added to the 2000 Loop in 835's template:
[Splitter]
[DataMember]
[Required]
[Pos(7)]
public virtual List<Loop_2000_834> Loop2000 { get; set; }In code, set Split = true to enable splitting, and Split = false to disable it.
-
Small file
Download the file, that contains a single X12 5010 834 message with 2 employee enrollments.
-
Large file
Download the file, that contains a single X12 5010 834 message with 100 000 employee enrollments.
-
System Setup
EdiFabric.10.1.0
BenchmarkDotNet=v0.12.0
OS=Windows 10.0.18363
Intel Core i7-9700 CPU 3.00GHz, 1 CPU, 8 logical and 8 physical cores
.NET Core SDK=3.1.402
[Host] : .NET Core 3.1.8 (CoreCLR 4.700.20.41105, CoreFX 4.700.20.41903), X64 RyuJIT
Test the parsing speed
The code:
public static void Run()
{
Stopwatch watch = Stopwatch.StartNew();
var edi = File.OpenRead(@"C:\Hipaa_834_Large.txt");
using (var ediReader = new X12Reader(edi, "EdiFabric.Templates.Hipaa",
new X12ReaderSettings { Split = false }))
{
while (ediReader.Read())
{
}
}
watch.Stop();
Console.Write(watch.ElapsedMilliseconds);
Console.ReadKey();
}
The results:
Test | Elapsed | Allocated at start | Allocated at end |
---|---|---|---|
Small file | 125 ms | 1 MB | 25 MB |
Large file | 44 s | 1 MB | 347 MB |
Large file with splitting | 48 s | 1 MB | 25 MB |
Test the validation speed
The code:
public static void Run()
{
var validation = new List<Task<Tuple<bool, MessageErrorContext>>>();
Stopwatch watch = Stopwatch.StartNew();
var edi = File.OpenRead(@"C:\Hipaa_834_Large.txt");
using (var ediReader = new X12Reader(edi, "EdiFabric.Templates.Hipaa",
new X12ReaderSettings { Split = false }))
{
while (await ediReader.ReadAsync())
{
MessageErrorContext mec;
var msg = ediReader.Item as TS834;
if (msg != null)
{
validation.Add(msg.IsValidAsync());
}
}
}
Task.WaitAll(validation.ToArray());
watch.Stop();
Console.Write(watch.ElapsedMilliseconds);
Console.ReadKey();
}
The results:
Test | Elapsed | Allocated at start | Allocated at end |
---|---|---|---|
Small file | 152 ms | 1 MB | 25 MB |
Large file | 2 min 52 s | 1 MB | 3 GB |
Large file with splitting | 58 s | 1 MB | 136 MB |
How to test my own files?
To evaluate your own files head on to the Demo project in each solution, and change the path to a local file on your machine.
- Hipaa_834.zip498 Bytes
- Hipaa_834_Large.zip100 KB
Comments
0 comments
Please sign in to leave a comment.