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
Copy file name to clipboardExpand all lines: README.md
+115-3Lines changed: 115 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,7 +152,7 @@ Each time the Parser calls back to the client code, it provides a ResolvedApplic
152
152
153
153
### Performance
154
154
155
-
The GS1 AI Parser is a high-performance library. As far as possible, parsing operations are carried out on the stack and heap allocations are avoided. This significantly increases the performance of the library and avoids unnecessary garbage collection.
155
+
The GS1 AI Parser is a high-performance library. As far as possible, parsing operations are carried out on the stack and heap allocations are avoided. This significantly increases the performance of the library and avoids unnecessary garbage collection. Internally, modern versions of .NET use SIMD instructions where appropriate to further boost performance.
156
156
157
157
158
158
@@ -164,9 +164,9 @@ If the client application is written using the older .NET Framework, it will not
164
164
165
165
166
166
167
-
To eliminate heap allocations, use ParseEx(). This method is supported only on the .NET 7.0 platform, or higher. Again, there is little difference in performance. However, ParseEx() invokes a ResolvedElementDelegate, passing a ResolvedApplicationIdentifierRef ref struct which lives on the stack.
167
+
To eliminate heap allocations, use ParseEx(). This method is supported only on the .NET 7.0 platform, or higher. ParseEx() does not generally provide any significant performance improvement. However, it invokes a ResolvedElementDelegate, passing a ResolvedApplicationIdentifierRef ref struct which lives on the stack. ParseEx() is only recommended for use in systems that require reliable high-performance and real-time processing.
168
+
168
169
169
-
170
170
171
171
As a broad indication of performance, you could reasonably expect, in an ideal scenario, that a modern CPU can parse 600,000 - 800,000 instances per second of valid barcode data containing four GS1 entities (e.g., unique identifiers on the secondary packaging of medicinal products). Of course, actual performance will depend on other factors, including the version of .NET, the number of errors detected in the barcode data, the performance of your client code, CPU and memory specifications, environmental load on the CPU, etc.
172
172
@@ -191,6 +191,118 @@ Performance drops when data relationship rules are performed. Memory allocations
191
191
192
192
193
193
194
+
The library is not compiled using pre-jitting ('ready-to-run' - requires the .NET runtime). This could be useful to maximise performance in scenarios where the parser is instantiated and invoked in a one-shot manner. While it is possible to publish multiple pre-jitted images in a NuGet package, there are limitations which make the package harder to use. If you need to pre-jit the code, try pre-jitting your client code. Alternatively, compile and publish the source code yourself. For example, to publish for the Win-64 platform, use the following command lines:
The GS1 parser library is CLS-compliant, ensuring good interoperability across different .NET languages.
209
+
210
+
211
+
212
+
#### Native Code Library
213
+
214
+
Modern versions of .NET provide good support for AOT (Ahead-of-Time) Native code generation. The generated code targets a specific platform (e.g., win-x64) and runs independently of the .NET runtime. Native code libraries can be used by a wide range of compiler technologies, bytecode environments (Java, WASM etc.) and languages. To facilitate this approach to interoperability, we provide the Solidsoft.Reply.Parsers.Gs1Ai.Native.win-x64 project. This project is configured to publish a native code library for win-x64. To build the code, you must ensure you have the correct toolchain installed. For example, Visual Studio users can include the 'Desktop development with C++' workload in their Visual Studio installation to build the code for the win-x64 target platform. See https://learn.microsoft.com/uk-ua/dotnet/core/deploying/native-aot/?tabs=windows%2Cnet8 for additional information. To demonstrate the use of the native code generated by this project, we have included the Solidsoft.Reply.Parsers.Gs1Ai.Native.Tester project. This is a C++ Console application that demonstrates the use of the native GS1 Parser library.
215
+
216
+
217
+
218
+
The native code library exports three functions as a C ABI:
219
+
220
+
221
+
222
+
Gs1Ai\_Callback
223
+
224
+
Gs1Ai\_SetExceptionCallback
225
+
226
+
Gs1Ai\_Parse
227
+
228
+
229
+
230
+
Use the first two functions to set the main call-back and an additional call-back for exceptions. Then use Gs1\_Parse to parse the input string.
231
+
232
+
233
+
234
+
void \_\_stdcall Gs1Ai\_Callback(
235
+
236
+
wchar\_t\*, // identifier (UTF-16 on Windows)
237
+
238
+
int, // length of identifier
239
+
240
+
wchar\_t\*, // value (UTF-16 on Windows)
241
+
242
+
int, // length of value
243
+
244
+
int, // entity
245
+
246
+
wchar\_t\*, // Data title (UTF-16 on Windows)
247
+
248
+
int, // Length of data title
249
+
250
+
wchar\_t\*, // Description (UTF-16 on Windows)
0 commit comments