Loading license is very slow Aspose.barcode with Aspose.total license


#1

Aspose.BarCode.License l = new License();
l.SetLicense(“Aspose.Total.lic”);

These 2 lines of code take 5 seconds to execute on a fast machine (8 cores Xeon, 8GB ram). 1 core is 100% during the 5 seconds.

License is loaded from embedded resources.
I’ve tried 64 bit target, X86 and Any Cpu with no change.
Debug and Release build are equal.
Tried .net 4.0 and 4.5 with no more luck.

Problem is that this time is almost 90% of total execution time of this console application that just read a barcode from an image.


#2

@xd-1,

We have tested the scenario at our end. We have noticed that on a machine with 8 GB RAM, i7 CPU, 2.6 GHz it took 119 milliseconds. However an investigation ticket has been logged into our system with ID BARCODENET-36789. Our product team will further look into it. We will update you here once there is some information available in this regard.


#3

To be totally accurate, this is the SetLicense method that is taking the whole timing.

Do you need the source code/project ? It is very simple.

Thanks


#4

@xd-1,

Thank you for details. Yes, the code is very simple so no need for that. We have forwarded the information to our product team. Please update us which version of Aspose.BarCode are you using?


#5

Please find attached the DLL info.

Thanks

Capture d’écran 2018-01-22 à 09.04.49.png (5.0 KB)


#6

@xd-1,

Thank you for information but unfortunately we are unable to open the attached image file. Please send it again.


#7

Aspose.BarCode from .net 4.0
V 17.9
3/11/2017


#8

@xd-1,

Thank you for update.


#9

@xd-1,

We have tested the scenario with the latest version of Aspose.BarCode and it took 119 milliseconds. Please try the Aspose.BarCode latest version. Feel free to contact us in case of any query or comments.


#10

Hello,
Just reviving this ticket as we updated to latest build V19.9 and exact same issue experienced in dev environment and on production servers: Slow set license call (5 seconds).

Can you send me your project file to see what settings you are using to setup the VS project.

Here is the source executed. l.SetLicense method takes about 4-5 seconds to execute, always.

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Text;
using Aspose.BarCode.BarCodeRecognition;
using Aspose.BarCode;

namespace BacodeReader
{
class Program
{
static void Main(string[] args)
{

        string source = args[0];

        Aspose.BarCode.License l = new License();
        l.SetLicense("Aspose.Total.lic");
        
        BarCodeReader barCodeReader = new BarCodeReader(source);

        // Set grayscale image processing
        //barCodeReader.RecognitionMode = RecognitionMode.MaxBarCodes;

        // Try to recognize all possible barcodes in the image and Display the codetext
        while (barCodeReader.Read())
        {
            Console.WriteLine("("+barCodeReader.GetCodeType().ToString()+") " + barCodeReader.GetCodeText());
        }
        // Close the reader
        barCodeReader.Close();

    }
}

}


#11

@xd-1,
I have tried this scenario using latest version Aspose.BarCode for .NET 19.9 but could not observe any issue as license loading took around 200 to 300 milli seconds only as expected on my test machine which is Windows 7 VM with 8 GB RAM. For your reference complete solution is attached here for your testing. Please give it a try and share the feedback.


#12

@xd-1,

I also tested your scenario in a simple console demo application on Windows8, it works fine and as expected. I added Aspose.Total license as an embedded resource to the project and use simplest lines of code and it takes less than 100 milliseconds only to load and set the license. I have attached two screenshots for your reference.


#13

Hello.

The problem might be with slow access to embedded resource. Try to load license to memory stream and then load as license. This might help.

MemoryStream lMstr = new MemoryStream();
//load license file to MemoryStream
lMstr.Position = 0;
new Aspose.BarCode.License().SetLicense(lMstr);


#14

Found the issue…

The license file was located in the Resources sub-folder of the project. Moving it to root level of the project in VS changed the speed immediately. Seems that the set license function is not optimized to look in the Resources folder…

Please note that MS recommends resource files to be located in the Resources folder of project.

Thanks,