Benchmark

Prerequisites

We tested the speed (using .NET Stopwatch) and memory allocation when parsing a small and a large X12 834 file using the .NET Core 3.1 version of X12 Reader. We did two tests for the large file - with and without splitting. Then we tested the speed and memory allocation when validating the large file.

Added the [Splitter] attribute to the 2000 Loop in 835's template:

[Splitter]
[DataMember]
[Required]
[Pos(7)]
public virtual List<Loop_2000_834> Loop2000 { get; set; }
  • 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

 

 

 


 

 

 

1. Parsing speed and memory allocation results:

The code we used (set Split = true to enable splitting):

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(); }
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

 

 

 


 

 

 

2. Validation speed and memory allocation results:

The code we used (set Split = true to enable splitting):

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(); }
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

 

 

Was this article helpful?
6 out of 6 found this helpful