We upgraded the version of Aspose.BarCode in our product from 3.0.1.1211 to 7.2.0.0 for better barcode detection. Though we observed a improved detection but we have experienced extreme performance issues with the new version.
While version 3.0 recognised the barcodes on a simple small image (attached) in 60-65 ms, the new version 7.2 worked for about 300 ms. The time duration is about 5 times than the old version even though the symbology is restricted to DataMatrix in both the versions. The library with this speed is unusable.
We have multiple customers in a state where they basically can't work as a result of performance at a point that makes it unusable. All of these issues did not surface until we upgraded.
To reproduce the issue, we have made two C++ console applications (.exe) using DataMatrix barcode. The sample input bmp file is attached.
Program for 7.2.0.0
-------------------------
#include
#include
#include
using namespace System;
#using "System.Drawing.Dll"
using namespace System::Drawing;
using namespace System::Diagnostics;
using namespace Aspose::BarCode;
using namespace Aspose::BarCodeRecognition;
static void ProcessBarcode();
int main ()
{
int iReturn = 0;
ProcessBarcode();
return iReturn;
}
static void ProcessBarcode()
{
Aspose::BarCode::License ^lic = gcnew Aspose::BarCode::License();
lic->SetLicense("Aspose.BarCode.Lic");
Stopwatch^ watch = gcnew Stopwatch();
watch->Start();
String^ imgPath = gcnew String("image.bmp");
Bitmap^ image = gcnew Bitmap (imgPath);
BarCodeReader ^br = gcnew BarCodeReader(image, BarCodeReadType::DataMatrix);
if (br->Read())
{
printf("\nContent: %s", br->GetCodeText() );
}
watch->Stop();
printf("\n\nElapsed time %lld milliseconds", watch->ElapsedMilliseconds);
getch();
}
Program for 3.0.1.1211
-------------------------------
#include
#include
#include
using namespace System;
#using "System.Drawing.Dll"
using namespace System::Drawing;
using namespace System::Diagnostics;
using namespace Aspose::BarCode;
static void ProcessBarcode();
int main ()
{
int iReturn = 0;
ProcessBarcode();
return iReturn;
}
static void ProcessBarcode()
{
Aspose::BarCode::License ^lic = gcnew Aspose::BarCode::License();
lic->SetLicense("Aspose.BarCode.Lic");
Stopwatch^ watch = gcnew Stopwatch();
watch->Start();
String^ imgPath = gcnew String("image.bmp");
Bitmap^ image = gcnew Bitmap (imgPath);
BarCodeReader ^br = gcnew BarCodeReader(image);
br->BarCodeReadType = BarCodeReadType::DataMatrix;
array^pResults = br->Read();
BarCodeInfo ^currentBarCodeInfo = pResults[0];
// get length of the Barcode
array^ CodeBytes = currentBarCodeInfo->CodeBytes;
long lCharLen = CodeBytes->Length;
if (lCharLen)
{
char *pchNewBarcode = new char [lCharLen + 1];
pchNewBarcode[lCharLen] = 0x00;
for (long lCharCnt = 0; lCharCnt < lCharLen; lCharCnt++)
{
pchNewBarcode[lCharCnt] = (char) CodeBytes[lCharCnt];
}
printf("\nContent: %s", pchNewBarcode );
}
watch->Stop();
printf("\n\nElapsed time %lld milliseconds", watch->ElapsedMilliseconds);
getch();
}