Deleting Data Woefully Slow
Mark Wieder
mwieder at ahsoftware.net
Thu Mar 25 21:14:20 EDT 2010
Richard-
Thursday, March 25, 2010, 5:19:35 PM, you wrote:
> I'm afraid that one has me mystified as well. It may have something to
> do with what the engine has to do to traverse to the end of a chunk, but
> I can't imagine why the difference would be so much.
If I were coding this in C I'd probably do something like (warning:
untested code I'm making up on the spot out of the dim recesses of my
memory):
char *FindEndOfFirstLine(char *pText)
{
char *pChar;
while(*pChar++)
{
if('\n' == *pChar)
{
// *++pChar = 0;
break;
}
}
return pChar;
}
char *FindLastLine(char *pText)
{
char *pChar;
pChar = pText;
pText += length(pText);
if('\n' == *pChar)
pChar--;
while('\n' != *pChar--)
{
if (pChar == pText)
break;
}
// *++pChar = 0;
return pChar;
}
So I'd allow a little extra time for the length() call, but I wouldn't
expect an order of magnitude difference.
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list