performance issue between vintasoft 8 and 10

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
Echtelion
Posts: 4
Joined: Mon Jun 19, 2017 8:11 pm

performance issue between vintasoft 8 and 10

Post by Echtelion »

Hi,

I have a performance decrease when upgrading vintasoft.twain from 8.4.0.1 to 10.2.2.1
I have a fast 60ppm scanner (fujitsu fi-7160), doing recto/verso scan in one pass.

cachemode=both, transfermode=memory, color=grayscale
Acquire
The device start scanning fast. After around 25 pages, the device stop scanning fast, and take pages one by one.
The device buffer is probably not flushed fast enough, so the device stop scanning and wait for the buffer to be free.

After analysing, the _device_ImageAcquired is fired way slowly than in the previous version, even if I do nothing in this event.
In 10.2.2.1, event is fired every 1.35sec
In 8.4.0.1, event is fired every 0.8sec

The issue is not present when using transferMode=native (same 0.9sec between events in both versions)

It's hard to see where is the bottleneck, as your assembly are obfuscated.
I can only say there is a lot a Thread.Sleep visible in the profiler.

Thanks for reviewing this issue,
Regards,
Romain Lagrange
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: performance issue between vintasoft 8 and 10

Post by Alex »

Hi Romain,

I think your problem is related with memory usage. Please check that you disposing the acquired image when image is not necessary any more.

Best regards, Alexander
Echtelion
Posts: 4
Joined: Mon Jun 19, 2017 8:11 pm

Re: performance issue between vintasoft 8 and 10

Post by Echtelion »

Hi Alex,

I'm sorry, but disposing the image didn't change the game.
850ms vs 1311ms

Here is the benchmark :

Code: Select all

DateTime lastEvent = DateTime.Now;
List<double> spans = new List<double>();
private void _device_ImageAcquired(object sender, ImageAcquiredEventArgs e)
{
    DateTime start = DateTime.Now;
    var span = (start - lastEvent).TotalMilliseconds;
    Debug.WriteLine("Start analyze at " + start.ToString("HH:mm:ss.ffffzzz") + ", diff from prev start is " + span + "ms");
    lastEvent = start;
    spans.Add(span);

    if (_parentForm.InvokeRequired)
    {
        _parentForm.BeginInvoke(new Action<object, ImageAcquiredEventArgs>(_device_ImageAcquired), sender, e);
    }
    else
    {
        //benchmark : don't do anything
        //AnalyseAcquiredImage(e.Image);
        
        // debug only : dispose. discard in prod.
        if (!e.Image.IsDisposed)
            e.Image.Dispose();
    }

    Debug.WriteLine("TaskRun " + DateTime.Now.ToString("HH:mm:ss.ffffzzz") + ", so event take " + (DateTime.Now - start).TotalMilliseconds + "ms to be processed");

    //if (e.EndOfJob)
        Debug.WriteLine("Average span is " + (spans.Sum() / spans.Count) + "ms");
}
As you can see, I'm just doing nothing but disposing the image, and I still reproduce the issue.
Thanks.
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: performance issue between vintasoft 8 and 10

Post by Alex »

Hello,

Provided code is not enough for understanding the problem. Please create 2 small console applications (for version 8 and 10), which demonstrate the problem, and send your applications to our support at support@vintasoft.com.

Best regards, Alexander
Echtelion
Posts: 4
Joined: Mon Jun 19, 2017 8:11 pm

Re: performance issue between vintasoft 8 and 10

Post by Echtelion »

I indeed don't reproduce the issue when starting a new UI from scratch, even with all the device settings being the sames.

This become more and more abscure, as the issue is still here in my "real world app", and the only difference between the two versions of my app is the vintasoft dll.

As the TransferMode=Native fix the issue, it's possible that a garbage collector struggling is a cause...
I'll do additional testings to narrow the root of this issue and will be back if I find something :)

Thanks
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: performance issue between vintasoft 8 and 10

Post by Alex »

Hello,

Thank you for information. Let me know if our assistance will be necessary.

Best regards, Alexander
Post Reply