Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1149 from JohannesDeml/benchmarkSerializerNaming
Benchmark serializer naming
- Loading branch information
Showing
18 changed files
with
464 additions
and
356 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
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
29 changes: 0 additions & 29 deletions
29
benchmark/SerializerBenchmark/Serializers/BinaryFormatter.cs
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
benchmark/SerializerBenchmark/Serializers/BinaryFormatterSerializer.cs
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,34 @@ | ||
// Copyright (c) All contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.IO; | ||
using System.Runtime.Serialization.Formatters.Binary; | ||
|
||
namespace Benchmark.Serializers | ||
{ | ||
public class BinaryFormatterSerializer : SerializerBase | ||
{ | ||
public override T Deserialize<T>(object input) | ||
{ | ||
using (var ms = new MemoryStream((byte[])input)) | ||
{ | ||
return (T)new BinaryFormatter().Deserialize(ms); | ||
} | ||
} | ||
|
||
public override object Serialize<T>(T input) | ||
{ | ||
using (var ms = new MemoryStream()) | ||
{ | ||
new BinaryFormatter().Serialize(ms, input); | ||
ms.Flush(); | ||
return ms.ToArray(); | ||
} | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return "BinaryFormatter"; | ||
} | ||
} | ||
} |
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
30 changes: 17 additions & 13 deletions
30
benchmark/SerializerBenchmark/Serializers/CerasSerializer.cs
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,21 +1,25 @@ | ||
// Copyright (c) All contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Benchmark.Serializers; | ||
|
||
#pragma warning disable SA1649 // File name should match first type name | ||
|
||
public class Ceras_ : SerializerBase | ||
namespace Benchmark.Serializers | ||
{ | ||
private Ceras.CerasSerializer ceras = new Ceras.CerasSerializer(); | ||
|
||
public override T Deserialize<T>(object input) | ||
public class CerasSerializer : SerializerBase | ||
{ | ||
return this.ceras.Deserialize<T>((byte[])input); | ||
} | ||
private Ceras.CerasSerializer ceras = new Ceras.CerasSerializer(); | ||
|
||
public override object Serialize<T>(T input) | ||
{ | ||
return this.ceras.Serialize(input); | ||
public override T Deserialize<T>(object input) | ||
{ | ||
return this.ceras.Deserialize<T>((byte[])input); | ||
} | ||
|
||
public override object Serialize<T>(T input) | ||
{ | ||
return this.ceras.Serialize(input); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return "Ceras"; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.