Skip to content

Adds Memory Buffer APIs#30

Merged
mitchelsellers merged 16 commits intomainfrom
memory_buffer
Sep 8, 2021
Merged

Adds Memory Buffer APIs#30
mitchelsellers merged 16 commits intomainfrom
memory_buffer

Conversation

@SkyeHoefling
Copy link
Contributor

@SkyeHoefling SkyeHoefling commented Sep 7, 2021

Fixes: #9

Description

Adds new Memory Buffer APIs, unit tests and benchmarks

IImage - New APIs

byte[] ToArray(int quality = 90);
ReadOnlySpan<byte> ToSpan(int quality = 90);
Stream ToStream(int quality = 90);

Merge Checklist

  • Added unit or integration tests (if not explain)
  • Benchmarks are equivalent or faster
  • Upload new Benchmark results

@SkyeHoefling SkyeHoefling changed the title Adds Memory Buffer APIs to IImage Adds Memory Buffer APIs Sep 7, 2021
@github-actions
Copy link

github-actions bot commented Sep 7, 2021

Benchmark Comparison

Benchmarking comparison between this Pull Request and the comitted values at benchmarks/results

thumbnail

 summary:
better: 1, geomean: 1.148
total diff: 1

No Slower results for the provided threshold = 10% and noise filter = 0.3ns.

| Faster                                                    | base/diff | Base Median (ns) | Diff Median (ns) | Modality|
| --------------------------------------------------------- | ---------:| ----------------:| ----------------:| -------- |
| FileOnQ.Imaging.Heif.Benchmarks.Thumbnail.Thumbnail_Write |      1.15 |      60288300.00 |      52499750.00 | several?|

No file given
 

primary

 No differences found between the benchmark results with threshold 10%.
 

Benchmark Results

thumbnail

BenchmarkDotNet=v0.13.0, OS=Windows 10.0.17763.2114 (1809/October2018Update/Redstone5)
Intel Xeon CPU E5-2673 v4 2.30GHz, 1 CPU, 2 logical and 2 physical cores
.NET SDK=5.0.400
 [Host]     : .NET 5.0.9 (5.0.921.35908), X64 RyuJIT
 Job-FJVQTT : .NET 5.0.9 (5.0.921.35908), X64 RyuJIT

Runtime=.NET 5.0  InvocationCount=1  LaunchCount=1  
UnrollFactor=1  
Method Mean Error StdDev Median Gen 0 Gen 1 Gen 2 Allocated Allocated native memory Native memory leak
Thumbnail_Write 52.41 ms 1.036 ms 2.746 ms 52.50 ms - - - 288 B 5,125,137 B -
Thumbnail_ToArray 48.68 ms 1.194 ms 3.503 ms 47.95 ms - - - 66,408 B 5,124,581 B -
Thumbnail_ToSpan 50.10 ms 1.206 ms 3.555 ms 49.83 ms - - - 120 B 5,124,581 B -
Thumbnail_ToStream 48.84 ms 1.220 ms 3.577 ms 47.63 ms - - - 66,472 B 5,124,581 B -

primary

BenchmarkDotNet=v0.13.0, OS=Windows 10.0.17763.2114 (1809/October2018Update/Redstone5)
Intel Xeon CPU E5-2673 v4 2.30GHz, 1 CPU, 2 logical and 2 physical cores
.NET SDK=5.0.400
 [Host]     : .NET 5.0.9 (5.0.921.35908), X64 RyuJIT
 Job-UAQZJA : .NET 5.0.9 (5.0.921.35908), X64 RyuJIT

Runtime=.NET 5.0  InvocationCount=1  LaunchCount=1  
UnrollFactor=1  
Method Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated Allocated native memory Native memory leak
PrimaryImage_Write 2.736 s 0.0409 s 0.0341 s - - - 256 B 222,029,948 B -
PrimaryImage_ToArray 2.896 s 0.0486 s 0.0596 s - - - 1,943,008 B 222,029,376 B -
PrimaryImage_ToSpan 2.775 s 0.0372 s 0.0310 s - - - 88 B 222,029,424 B -
PrimaryImage_ToStream 2.738 s 0.0416 s 0.0389 s - - - 1,943,072 B 222,029,552 B -

@SkyeHoefling
Copy link
Contributor Author

This PR requires new benchmark results to be uploaded prior to merging. I added a new checklist item to the PR description

@SkyeHoefling
Copy link
Contributor Author

I just looked through the code changes and it appears there is issues with tabs in several areas of the code. There are extra tabs or not enough tabs.

I am going to do another pass and push changes

@SkyeHoefling
Copy link
Contributor Author

SkyeHoefling commented Sep 8, 2021

@mitchelsellers I think this PR is good, can you take a look and see if I missed any typos or anything. If you think it is good to go please merge it.

I did not add XML docs to this PR as we are going to do all XML docs in #22 for the 1.0.0 release

@mitchelsellers mitchelsellers merged commit d5ddd1c into main Sep 8, 2021
@SkyeHoefling SkyeHoefling deleted the memory_buffer branch September 8, 2021 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory Buffer API

2 participants