DHTMLEdit - Registered Users - Helpdesk
Live Spell
Thread Starter: Wikky Started: 11/9/2006 10:19 PM UTC
Replies: 19
Live Spell
Hi,

1)How can we speed up the Live Spell checker ?

As example, with a document that contain about 1500 words, it take an average
of 9 seconds every time the Invalidate is called.

2) A problem with LoadUrl function.

As exemple, by using your version 2 demo, set the browsemode property to true
and try editor.LoadURL('http://sympatico.msn.ca/defaultf.aspx');

Five or 6 Blank (about:blank) instance of IE are opened and finally the
editor component just disappear. At least, is no more visible.

NB: Tested with Delphi 7, IE7 and ProfDHTMLEdit v2.0.3.1

Thank you
Re: Live Spell
I can confirm this, but with much slower results.  

Loading an HTML file with 1600 words locked up the app for more than 2 minutes (on a 2.4Mhz Core 2 Duo with 2GB RAM) everytime the text was changed.
Re: Live Spell
Hi Wikky:

1)How can we speed up the Live Spell checker ?

As example, with a document that contain about 1500 words, it take an average
of 9 seconds every time the Invalidate is called.

We shall offer some optimizations in a future release of ProfDHTMLEdit.

2) A problem with LoadUrl function.

As exemple, by using your version 2 demo, set the browsemode property to true
and try editor.LoadURL('http://sympatico.msn.ca/defaultf.aspx');

Five or 6 Blank (about:blank) instance of IE are opened and finally the
editor component just disappear. At least, is no more visible.

Try to amend TProfDHTMLEdit2.BeforeNavigate2Handler as follows:
   Cancel := True; { after this line }
   if URL <> AboutBlank then { add this line }
   if Win32Platform = VER_PLATFORM_WIN32_NT then { before this line }


-Nicholas
Re: Live Spell
I can confirm this, but with much slower results.

Loading an HTML file with 1600 words locked up the app for more than 2
minutes (on a 2.4Mhz Core 2 Duo with 2GB RAM) everytime the text was
changed.

This should not be so slow - you are doing something else in your code that affects the speed.


-Nicholas
Re: Live Spell
We shall offer some optimizations in a future release of ProfDHTMLEdit.

Please do.  Live Spell Checking is a very cool feature that makes an application look much more professional.  However with the current performance I just can't include it my application.

A tool that I can recommend to all developers is Delphi Profiler.  Often when you use it you find the slowness is due to a completely different routine than you expected.  And once you have accurate timing, often small changes can make huge improvements to performance.

http://www.prodelphi.de/
Re: Live Spell
1)How can we speed up the Live Spell checker ?
2) A problem with LoadUrl function.

Please update to build 2.0.3.2.


-Nicholas
Re: Live Spell
Please do.  Live Spell Checking is a very cool feature that makes an application look much more professional.  However with the current performance I just can't include it my application.

Please try out build 2.0.3.2 - it should be several times faster than build 2.0.3.1.


-Nicholas
Re: Live Spell
Hi Nicholas,

I tried this version, but I'm afraid it doesn't even come close to the performance needed. Just a couple of paragrahs of text makes editing with live spelling impossible. Really too bad, because this is a feature that would be very welcomed by end users.

Bye,
Bart
Re: Live Spell
Hi Nicholas,

Thanks for working on the issue.

Yes, it is signficantly faster, 12 seconds compared with more than 2 minutes on my 1600 word test document.  However that is 12 seconds every time even a single letter is typed (with a document that is not atypically long on a computer that is better spec than most) which unfortunately still makes it impractical for general use.

nix
Re: Live Spell
Hi Bart:

I tried this version, but I'm afraid it doesn't even come close to the performance needed. Just a couple of paragrahs of text makes editing with live spelling impossible.

Please download and test http://www.profgrid.com/test/LiveSpell/2.0.3.2/Project1.zip


-Nicholas
Re: Live Spell
Hi nix:

However that is 12 seconds every time even a single letter is typed

Please download and test http://www.profgrid.com/test/LiveSpell/2.0.3.2/Project1.zip


-Nicholas
Re: Live Spell
The typing is ok, but I think you have a value of about 5-10 seconds between each invalidate. That is too long. I suspect you tried something what I tried (and succeeded better at it I must say) to have an Timer interval working with the OnDocumentChanged event. The interval has to be shorter than the one you choose.

Could you elaborate on how you implemented the invalidate-call in this sample program?


"profgrid.com" <helpdesk@profgrid.com> wrote in message news:26a6de75
$30b45c41$a1c8@mps...
Hi Bart:

> I tried this version, but I'm afraid it doesn't even come close to the > performance needed. Just a couple of paragrahs of text makes editing with > live spelling impossible.

Please download and test http://www.profgrid.com/test/LiveSpell/2.0.3.2/Project1.zip


-Nicholas
Re: Live Spell
The typing is ok, but I think you have a value of about 5-10 seconds between each invalidate.

No.

Could you elaborate on how you implemented the invalidate-call in this sample program?

Sorry, forgot to include the source. Please re-download the zip.


-Nicholas
Re: Live Spell
"profgrid.com" <helpdesk@profgrid.com> wrote in message news:3cc3843b$415f8a74
$9b9c@mps...

Please update to build 2.0.3.2.


"profgrid.com" <helpdesk@profgrid.com> wrote in message news:3cc3843b$415f8a74
$9b9c@mps...

Please update to build 2.0.3.2.


Hello Nicholas,

Thank you for the update.

It is signficantly faster... but not really accurate for "real world" use.

I take a look at your demo, and my opinions are:

a)I think it is not necessary to spell check the document when it first loaded
 This can be a long process.
 As exemple: if you load a french document with only the english dict. active
 The document become fully underlined in red. This is disturbing.

 We already have a tool to spell check the entire document.

b) In my meanning, "Live Spell Check" mean "Spell Check as you type"
  So...
  The Spell Check should be done only on the current word.

  I think it can be possible to have an internal selection which is the
  current word, line or div.. and spell check just this selection.

Thank you for your help
Have a nice day
Re: Live Spell
Hi Nicholas

Yes, that allows you to type well, as long as you don't take your hand off the keyboard and then it is ten seconds of freeze...

Realistically if the app freezes for more than a second on a typical document on a typical computer then it is too slow to be usable.  

[Without looking at your code to see if it is practical] if you could limit the parsing to what is visible onscreen that might do it.

From quickly looking at the Addict source, [for a RichEdit] they only check spelling errors for displayed lines and then store spell results for the lines in a "LineCache".  This makes it fast and totally scalable (instananeous response even on a document of over 300,000 words).

I think you should model your code on theirs.
Re: Live Spell
Yes, that allows you to type well, as long as you don't take your hand off the keyboard and then it is ten seconds of freeze...

OK, please test:

http://www.profgrid.com/test/LiveSpell/2.0.3.3_Beta/Project1.zip


-Nicholas
Re: Live Spell
Wow, that background parsing is very slick.  You don't see any lag when typing now.  Very nice work.

My only nag would be that it doesn't scale well.  It finds errors very quickly with a small document, but gets progressively slower as the document size increases (I wouldn't want users to think their document contained no spelling errors, because they hadn't waited long enough for it to parse).

Did you investigate the practicality of caching the unchanged lines?
Re: Live Spell
I tried this one and it has one particular problem: the screen doesn't get updated with the invalid words. it is only after I activated another application and activate the test program again that I see the red marks.
Because of this, I can't tell you anything about speed.

Bye,
Bart

"profgrid.com" <helpdesk@profgrid.com> wrote in message news:3ac39901
$2443ee02$1561a@mps...
> Yes, that allows you to type well, as long as you don't take your hand off > the keyboard and then it is ten seconds of freeze...

OK, please test:

http://www.profgrid.com/test/LiveSpell/2.0.3.3_Beta/Project1.zip


-Nicholas
Re: Live Spell
Wow, that background parsing is very slick.  You don't see any lag when typing now.  Very nice work.
My only nag would be that it doesn't scale well.  It finds errors very quickly with a small document, but gets progressively slower as the document size increases (I wouldn't want users to think their document contained no spelling errors, because they hadn't waited long enough for it to parse).

Please try out the updated test project:

http://www.profgrid.com/test/LiveSpell/2.0.3.3_Beta/Project1.zip


-Nicholas
Re: Live Spell
I think it is not necessary to spell check the document when it first loaded
This can be a long process.
As exemple: if you load a french document with only the english dict. active
The document become fully underlined in red. This is disturbing.

This is just a sample project. And it is certainly up to you to decide where from and how often to initiate live spell-check operations in your projects.


-Nicholas

Page 1 of 3 Next >