We are running into very poor performance when using barcode recognition on .Net MAUI for android. We tested it with a basic .Net MAUI template project for .net 8: triggering barcode recognition on two images (code39Standard and code128) with Aspose BarCode 24.4. Recognition targeting a Windows machine takes 2 seconds, while doing the same targeting android 34 takes 35 seconds. I hope you can fix this in an upcoming release, because this is blocking for us.
Two embedded resources (c39standard.png and c128.jpg), but I think you can use any image and the difference between the two target platforms is huge.
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
using (Stream stream = GetStream("TestAsposeMaui.Resources.Images.c39standard.png"))
using (BarCodeReader read = new BarCodeReader(stream, DecodeType.Code39Standard ))
{
read.QualitySettings = QualitySettings.HighPerformance;
Console.WriteLine($"Barcodes read: {read.ReadBarCodes().Length}");
foreach (BarCodeResult result in read.FoundBarCodes)
Console.WriteLine($"{result.CodeTypeName}:{result.CodeText}");
}
using (Stream stream = GetStream("TestAsposeMaui.Resources.Images.c128.jpg"))
using (BarCodeReader read = new BarCodeReader(stream, DecodeType.Code128))
{
read.QualitySettings = QualitySettings.HighPerformance;
Console.WriteLine($"Barcodes read: {read.ReadBarCodes().Length}");
foreach (BarCodeResult result in read.FoundBarCodes)
Console.WriteLine($"{result.CodeTypeName}:{result.CodeText}");
}
stopWatch.Stop();
Console.WriteLine("Time elapsed:" + stopWatch.ElapsedMilliseconds);
@jimvandam,
Thanks for the details and sample code.
We will look into your issue and get back to you soon.
@jimvandam,
We tested your scenario/case a bit. We appreciate if you could provide a sample VS 2022 .NET MAUI app (please zip the project and resource files prior attaching) to reproduce the issue on our end. This will help us to evaluate your issue precisely and we may log appropriate ticket for it.
Please find attached the simple test project, which is actually just the vanilla .Net MAUI app with the code I shared as the button click action.
TestAsposeMaui.zip (4.4 MB)
@jimvandam,
Thanks for the sample app.
After an initial test, I was able to reproduce the issue as you mentioned. I found performance issue for Barcode recognition on .NET MAUI Android. I used an emulator when running after opening the project into VS.NET 2022. I found it takes more than 30 seconds (see the screenshot attached) when setting or configuring for Android emulators whereas it takes 2/3 seconds when configuring for Windows machine. I suspect this is something to do with Android runtime and its emulators which takes time when calling .NET core assembly.
sc_shot1.png (195.1 KB)
We need to evaluate the issue in details and check if we could enhance the performance a bit. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): BARCODENET-39012
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Thank you for the quick response and thorough analysis. Just wanted to add that we found the performance of the barcode recognition for the real android devices (like pixel and samsung) we tested to be roughly equal to the emulator numbers.
Hope you can release a fix soon.
@jimvandam,
Thank you for providing further details and findings.
We have logged your details with your existing ticket in our database. We will enhance the recognition engine with new QualitySettings structures to address performance issues.
Once we have updates on your issue, we will notify you here.