-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Class Serialisation Performance Maintenance (#284)
- Loading branch information
Showing
8 changed files
with
153 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: 'Full Workflow' | ||
|
||
env: | ||
VERSION: 4.6.1 | ||
VERSION: 4.6.2 | ||
ASM_VERSION: 4.0.0 | ||
|
||
on: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.Win32.SafeHandles; | ||
using Parquet.Serialization; | ||
|
||
namespace Parquet.PerfRunner.Benchmarks { | ||
|
||
class Record { | ||
public DateTime Timestamp { get; set; } | ||
public string? EventName { get; set; } | ||
public double MeterValue { get; set; } | ||
} | ||
|
||
|
||
[ShortRunJob] | ||
[MeanColumn] | ||
[MemoryDiagnoser] | ||
[MarkdownExporter] | ||
public class Classes { | ||
private List<Record>? _testData; | ||
private MemoryStream _ms = new MemoryStream(); | ||
|
||
[GlobalSetup] | ||
public async Task SetUp() { | ||
_testData = Enumerable.Range(0, 1_000).Select(i => new Record { | ||
Timestamp = DateTime.UtcNow.AddSeconds(i), | ||
EventName = i % 2 == 0 ? "on" : "off", | ||
MeterValue = i | ||
}).ToList(); | ||
|
||
await ParquetSerializer.SerializeAsync(_testData, _ms); | ||
} | ||
|
||
|
||
[Benchmark(Baseline = true)] | ||
public async Task Serialise_Legacy() { | ||
using var ms = new MemoryStream(); | ||
await ParquetConvert.SerializeAsync(_testData, ms); | ||
} | ||
|
||
[Benchmark] | ||
public async Task Deserialise_Legacy() { | ||
_ms.Position = 0; | ||
await ParquetConvert.DeserializeAsync<Record>(_ms); | ||
} | ||
|
||
[Benchmark] | ||
public async Task Serialise() { | ||
using var ms = new MemoryStream(); | ||
await ParquetSerializer.SerializeAsync(_testData, ms); | ||
} | ||
|
||
[Benchmark] | ||
public async Task Deserialise() { | ||
_ms.Position = 0; | ||
await ParquetSerializer.DeserializeAsync<Record>(_ms); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters