-
Notifications
You must be signed in to change notification settings - Fork 78
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 #115 from Numpsy/extension_bench
Add a couple of benchmarks for AsOLEPropertiesContainer
- Loading branch information
Showing
3 changed files
with
54 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.IO; | ||
using BenchmarkDotNet.Attributes; | ||
using OpenMcdf.Extensions; | ||
|
||
namespace OpenMcdf.Benchmark | ||
{ | ||
// Simple benchmarks for reading OLE Properties with OpenMcdf.Extensions. | ||
[SimpleJob(BenchmarkDotNet.Jobs.RuntimeMoniker.NetCoreApp31)] | ||
[MemoryDiagnoser] | ||
public class ExtensionsRead | ||
{ | ||
// Keep the Storage as a member, as we're only testing the OLEProperties bits, not the underlying CompoundFile | ||
private readonly CompoundFile udTestFile; | ||
|
||
// Load the test file on creation | ||
public ExtensionsRead() | ||
{ | ||
string testFile = Path.Combine("TestFiles", "winUnicodeDictionary.doc"); | ||
this.udTestFile = new CompoundFile(testFile); | ||
} | ||
|
||
[GlobalCleanup] | ||
public void GlobalCleanup() | ||
{ | ||
udTestFile.Close(); | ||
} | ||
|
||
[Benchmark] | ||
public void TestReadSummaryInformation() | ||
{ | ||
this.udTestFile.RootStorage.GetStream("\u0005SummaryInformation").AsOLEPropertiesContainer(); | ||
} | ||
|
||
[Benchmark] | ||
public void TestReadDocumentSummaryInformation() | ||
{ | ||
this.udTestFile.RootStorage.GetStream("\u0005DocumentSummaryInformation").AsOLEPropertiesContainer(); | ||
} | ||
} | ||
} |
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