HOLY COW, BATMAN!!!
Richard Gaskin
ambassador at fourthworld.com
Fri Jun 11 00:51:30 EDT 2004
Bob Nelson wrote:
> A HUGE Thank You to Phil Davis and Richard Gaskin for your response to "Not
> Shy..."
>
> Richard - I took your code, pretty much un-altered, added a progress bar to
> the page, and executed the same job on the same 140k lines of text. 25
> seconds. Total. Needless to say, I nearly fell out of my chair, onto the
> floor, in the throes of ecstasy.
>
> I think I'll be headed over to the Revolution site now and paying my money
> to become a Platinum supporter or something. I think this is going to work
> out well!
Glad that worked out. Tweak the increment used for the progress bar so
it updates less frequently and you'll see it get even faster. :)
> Okay, so has anybody got any pointers for existing code someone has used to
> dispose of HTML from a web page?
If all you want to do is strip HTML tags and get the text, you can use this:
set the htmlText of fld 1 to tSomeHtml
put the text of fld 1 into tSomePlainText
Another speed note: if the field you use to convert the htmlText is on
a card that isn't open (such as another card in the same stack or in a
substack that's closed but that's part of your mainstack's file so it's
in memory anyway) you'll find that getting and setting any text propery
(text, htmlText, or rtfText) of the field is many times faster than
doing the same action on a field on the current card.
I asked Tuviah about this, and he was kind enough to explain that fields
on open cards require a fair amount of overhead to set up, even when
their hidden, but fields on unopened cards use a much simpler set of
internal routines as the engine can know the field will not be
interacted with.
--
Richard Gaskin
Fourth World Media Corporation
___________________________________________________
Rev tools and more: http://www.fourthworld.com/rev
More information about the use-livecode
mailing list