NISUS Archives

June 2010

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Sat, 5 Jun 2010 12:14:36 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (36 lines)
On Jun 5, 2010, at 9:53 AM, Nobumi Iyanaga wrote:

> Below are two results of code profiling (I am sorry, they are long..., and certainly VERY VERY clumsy...). Perhaps I used "$text.find ..." in a wrong way?

> 95.9				if $fname.find '^Mojikyo', 'E'

Case-insensitive, PowerFind Pro mode and it has to identify not only the string itself but also its position.

With the following macro run on Nisus Macro Reference.zrtf:

Debug.setCodeProfilingEnabled true
$str = Cast to String 'en_US'
$doc = Document.active
$text = $doc.text
$i = $j = 500
while $i
	$range = $text.rangeOfString $str
	$i -= 1
end
while $j
	$sel = $text.find $str, '-i'
	$j -= 1
end


I got

29.8		$range = $text.rangeOfString $str
70.2		$sel = $text.find $str, '-i'


With s option, rangeOfString is still faster, though.


Kino

ATOM RSS1 RSS2