-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathBitmapByteQRCode.cs
50 lines (42 loc) · 1.42 KB
/
BitmapByteQRCode.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using BenchmarkDotNet.Attributes;
using QRCoder;
namespace QRCoderBenchmarks;
[MemoryDiagnoser]
public class BitmapByteQRCodeBenchmark
{
private readonly Dictionary<string, QRCodeData> _samples;
public BitmapByteQRCodeBenchmark()
{
var eccLvl = QRCoder.QRCodeGenerator.ECCLevel.L;
_samples = new Dictionary<string, QRCodeData>()
{
{ "small", QRCoder.QRCodeGenerator.GenerateQrCode("ABCD", eccLvl) },
{ "medium", QRCoder.QRCodeGenerator.GenerateQrCode("https://github.com/codebude/QRCoder/blob/f89aa90081f369983a9ba114e49cc6ebf0b2a7b1/QRCoder/Framework4.0Methods/Stream4Methods.cs", eccLvl) },
{ "big", QRCoder.QRCodeGenerator.GenerateQrCode( new string('a', 2600), eccLvl) }
};
}
[Benchmark]
public void RenderBitmapByteQRCodeSmall()
{
var qrCode = new BitmapByteQRCode(_samples["small"]);
_ = qrCode.GetGraphic(10);
}
[Benchmark]
public void RenderBitmapByteQRCodeMedium()
{
var qrCode = new BitmapByteQRCode(_samples["medium"]);
_ = qrCode.GetGraphic(10);
}
[Benchmark]
public void RenderBitmapByteQRCodeBig()
{
var qrCode = new BitmapByteQRCode(_samples["big"]);
_ = qrCode.GetGraphic(10);
}
[Benchmark]
public void RenderBitmapByteQRCodeHuge()
{
var qrCode = new BitmapByteQRCode(_samples["big"]);
_ = qrCode.GetGraphic(50);
}
}