locked
Delayed InkAnalyzer-Start? RRS feed

  • Question

  • Hi!

    I have a question concerning the InkAnalyzer. I made a control that uses that InkAnalyzer. If I start my application that has more of those controls on it the InkAnalyzer used at first needs much time until the first RecognitionResult is computed. If I then use another InkAnalyzer in another control it computes the Results much faster than the first one did. It seems that the InkAnalyzer needs some time to initialize itself.
    Is there a way to force that initialization so that the first run of a recognition runs as fast as the second one does?

    Sincerely
    TopperDEL
    Thursday, December 14, 2006 4:25 PM

Answers

  • Hi TopperDEL,

    the InkAnalysis assemblies are currently not pre-jitted at install time. So when you call InkAnalyzer.Analyze() the first time, the JIT-compiler has to process a lot code initially. Later calls will re-use the jitted code and are faster as a result.

    We are planning to address this in the next release of the InkAnalysis assemblies. For now, you can use the ngen utility that comes with the .NET Framework SDK to optimize the initial performance:

    ngen install iacore.dll
    ngen install Microsoft.Ink.Analysis.dll
    gacutil /i iacore.dll
    gacutil /i Microsoft.Ink.Analysis.dll

    (if you use InkAnalysis in WPF, please substitute Microsoft.Ink.Analysis.dll with IAWinFX.dll)

    Thanks, Stefan Wick

     

    Thursday, December 14, 2006 7:36 PM

All replies

  • Hi TopperDEL,

    the InkAnalysis assemblies are currently not pre-jitted at install time. So when you call InkAnalyzer.Analyze() the first time, the JIT-compiler has to process a lot code initially. Later calls will re-use the jitted code and are faster as a result.

    We are planning to address this in the next release of the InkAnalysis assemblies. For now, you can use the ngen utility that comes with the .NET Framework SDK to optimize the initial performance:

    ngen install iacore.dll
    ngen install Microsoft.Ink.Analysis.dll
    gacutil /i iacore.dll
    gacutil /i Microsoft.Ink.Analysis.dll

    (if you use InkAnalysis in WPF, please substitute Microsoft.Ink.Analysis.dll with IAWinFX.dll)

    Thanks, Stefan Wick

     

    Thursday, December 14, 2006 7:36 PM
  • Hi Stefan!

    Thank you very much, this did great for me!

    By the way: is there already any information about the next realease of the InkAnalysis assemblies available in the net? I'm very interested in new functionality and updates.

    Thank you!

    Kind regards
    TopperDEL
    Monday, December 18, 2006 7:47 AM
  • Hi there,

    As an alternative to Stefan's answer, you can always perform recognition on a "dummy" stroke when your app starts up so that when the user is ready to enter real ink, everything is ready to go. If you are deploying your app to multiple computers, this saves having to pre-jit the assemblies on each one as part of your installation preocedure.

    Here is some code that works for me:

     

    //Ensure drawing of initial stroke is not slowed down by "recognising" a dummy stroke.
    //_analyzer is a newly created InkAnalyzer object

     

    private void RecogniseDummyStroke()
    {
        StylusPointCollection spCollection = new StylusPointCollection();
        spCollection.Add(
    new StylusPoint(1, 1)); //Any point should do
        Stroke s = new Stroke(spCollection);
        _analyser.AddStroke(s);
        _analyser.Analyze();
        _analyser.RemoveStroke(s);
    }

    Hope this helps someone...

    Robert

    • Proposed as answer by revcom Sunday, July 12, 2009 9:48 PM
    Sunday, July 12, 2009 9:45 PM
  • Hi!

    Yeah - that did the job. I had the same idea just some days before. ;)

    Nevertheless - thank you!

    Regards

    TopperDEL
    Sunday, July 19, 2009 6:30 PM