On 12/8/06 12:09 PM, Alberto Paderno at [EMAIL PROTECTED] wrote:
> If you want to make your code faster, you could use the ElfData plug-in
> which has some classes to handle strings faster. You can find it on
> http://www.elfdata.com/plugin/: it runs on all platforms, and it's free to
> use if you just use it to make some code test, or to make some GPL licensed
> code.
> Read well how to use it correctly, and to avoid conversion from ElfData to
> string which would be worst than to use just strings.
Well, maybe I did something wrong, but this actually made it take longer,
and the IsNumeric function didn't work. I'll have to look into it later.
#pragma BackgroundTasks false
#pragma BoundsChecking false
dim fIn, fOut as FolderItem
dim t as Double = microseconds
fIn = DesktopFolder.Child( "test.txt" )
fOut = DesktopFolder.Child( "output.txt" )
dim tIn as TextInputStream = fIn.OpenAsTextFile
dim tOut as TextOutputStream = fOut.CreateTextFile
dim caseStr as ElfData = "case "
dim varStr as ElfData = "r = """
dim closingStr as ElfData = """" + chr( 13 )
dim line as ElfData
while not tIn.EOF
line = tIn.ReadLine
if IsNumeric( line ) then
line = caseStr + line
tOut.WriteLine( line )
else
line = line.ReplaceAll( """", """""" )
line = varStr + line + closingStr
tOut.WriteLine( line )
end if
wend
tIn.Close
tOut.Close
t = microseconds - t
t = t / 1000000
MsgBox( format( t, "#,0.000" ) + " seconds" )
__________________________________________________________________________
Kem Tekinay (212) 201-1465
MacTechnologies Consulting Fax (914) 242-7294
http://www.mactechnologies.com Pager (917) 491-5546
To join the MacTechnologies Consulting mailing list, send an e-mail to:
[EMAIL PROTECTED]
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>