You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reduced some allocations in QRCodeGenerator (NETCORE_APP only) (#595)
* Avoid allocation of gluedPolynoms when possible
* Avoid using Linq in MultiplyAlphaPolynoms
* Avoid Dictionary allocations in GetNotUniqueExponents
* Added comment to GetNotUniqueExponents on how it works
* GaloisField.ShrinkAlphaExp use bit-hacks instead of division / modulo
* CodewordBlock uses a pooled byte-array
* Avoid allocating closures in CapacityTables
* Avoid allocation closure in QRCodeGenerator
* Use a simple cache for the list codeWordWithECC
Copy file name to clipboardExpand all lines: QRCoder/QRCodeGenerator/CodewordBlock.cs
+28-3Lines changed: 28 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,11 @@
1
+
usingSystem;
2
+
usingSystem.Collections.Generic;
3
+
usingSystem.Threading;
4
+
5
+
#if NETCOREAPP
6
+
usingSystem.Buffers;
7
+
#endif
8
+
1
9
namespaceQRCoder;
2
10
3
11
publicpartialclassQRCodeGenerator
@@ -6,15 +14,15 @@ public partial class QRCodeGenerator
6
14
/// Represents a block of codewords in a QR code. QR codes are divided into several blocks for error correction purposes.
7
15
/// Each block contains a series of data codewords followed by error correction codewords.
8
16
/// </summary>
9
-
privatestructCodewordBlock
17
+
privatereadonlystructCodewordBlock
10
18
{
11
19
/// <summary>
12
20
/// Initializes a new instance of the CodewordBlock struct with specified arrays of code words and error correction (ECC) words.
13
21
/// </summary>
14
22
/// <param name="codeWordsOffset">The offset of the data codewords within the main BitArray. Data codewords carry the actual information.</param>
15
23
/// <param name="codeWordsLength">The length in bits of the data codewords within the main BitArray.</param>
16
24
/// <param name="eccWords">The array of error correction codewords for this block. These codewords help recover the data if the QR code is damaged.</param>
0 commit comments