#53899 - 2001-02-15 05:54 PM
Re: limits on arrays
|
cj
MM club member
   
Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
|
Ok, here is a VBScript version of my test script: filesizetest.vbs
code:
Dim filTest, sTemp, iTemp Set filTest = CreateObject("Scripting.FileSystemObject").OpenTextFile(Wscript.arguments.Item(0), 1) wscript.echo time
iTemp=0 do sTemp=filTest.ReadLine iTemp=iTemp+1 loop until filTest.atendofstream wscript.echo time wscript.echo iTemp & " lines" filTest.Close
Please run it like this: CSCRIPT scriptfilename.VBS testtextfilename.TXT If you use WScript (the default when you just run whatever.VBS, the wscript.echo commands become msgbox() and it affects the times... I ran that same 1.3MB file through this script and got: 02:55:24 02:55:25 30446 lines hmmm... someone better quickly tell me why I should keep using KiX  cj P.S. Here is the KiX test script: filesizetest.kix
code:
break on cls ; ; OPEN file size limit test ;
while $filename="" "Filename: " gets $filename ? loop ? "@time" ? open(1, $filename) $i=0 do $=readline(1) $i=$i+1 until @error<>0
close(1) ? "@time" ? "$i lines" ? beep quit
[This message has been edited by cj (edited 15 February 2001).]
|
|
Top
|
|
|
|
#53901 - 2001-02-15 06:54 PM
Re: limits on arrays
|
Paul_Berquam
Hey THIS is FUN
Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
|
quote:
hmmm... someone better quickly tell me why I should keep using KiX
Blasphemy.... That ranks up there with being a guy and telling your friends that you read through the directions to put a bookcase together.... Gang, I think we need to work on some intervention for cj....  ------------------
"He was a good little monkey and always very curious..."
_________________________
He was a good little monkey and always very curious...
|
|
Top
|
|
|
|
#53903 - 2001-02-15 11:10 PM
Re: limits on arrays
|
cj
MM club member
   
Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
|
Maybe they should put a chat area on this board  Shawn, here are the results of your script. This was running minimised.
code:
SHOWFILE Version 2.0 by cj ESC = quit ENTER = new line SPACE = clear 7:52:35 AM: INSERT INTO tblJournals (Tech, jDate) VALUES ('Chris Matheson', 'new journal') 7:52:36 AM: select id from tblJournals where tech='Chris Matheson' and jDate='new journal' 7:52:36 AM: 2 Queries run
Goodbye! C:\scripts>k shawnfiletest.kix
07:52:48 07:55:48 30446 lines C:\scripts>
So, to summarise, when it comes to reading each line of a 30,000 line 1.3MB text file and incrementing an integer: Pure KiX: 3:24 Pure VBS: 0:01 (prob less, but timer counts seconds) KiX & OLE: 3:00 On a relative scale: Pure KiX: 0.49% Pure VBS: 100% KiX & OLE: 0.56% On a positive note, OLE calls improve the performance of KiX scripts by 0.07%  cj
|
|
Top
|
|
|
|
#53905 - 2001-02-16 02:26 PM
Re: limits on arrays
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
You know cj - I think there is more going on here than meets the eye ! Either kix is really bad at file i/o or at alloc/dealloc'n string variables - or vbs is somehow "optimizing" your $sTemp into the bit bucket.But the notion of an optimizing script interpreter is a bit far fetched ! But those numbers are unbelievably dramatic (too say the least!)... Given the evidence - and since we used the OLE version of the kix script (which does everything the vbs script does) - I would say it has more to do with the way kix allocates and deallocates string vars ? Here's that kix ole script we tried... it opens up some interesting possiblities for marrying the richness of vbs with kix... code:
break on $filename = "test.dat" $filTest = val("&"+olecallfunc(olecreateobject("Scripting.FileSystemObject"), "opentextfile", "s", "$filename"))
?"@time" $iTemp = 0 do $sTemp = olecallfunc($filTest,"readline") $iTemp = $iTemp + 1 until olegetproperty($filTest,"atendofstream") = "-1" ?"@time" ?"$iTemp lines" $= olecallfunc($filTest,"close")
exit
Shawn.
|
|
Top
|
|
|
|
#53908 - 2001-02-16 07:03 PM
Re: limits on arrays
|
Paul_Berquam
Hey THIS is FUN
Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
|
Sounds good to me. ------------------
"He was a good little monkey and always very curious..."
_________________________
He was a good little monkey and always very curious...
|
|
Top
|
|
|
|
#53914 - 2001-02-16 08:31 PM
Re: limits on arrays
|
Paul_Berquam
Hey THIS is FUN
Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
|
I had to go and recreate the room. You should be able to find it now Sarge. Just go to Yahoo chat. then log in, select computers/programming then go to user forums.
_________________________
He was a good little monkey and always very curious...
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 829 anonymous users online.
|
|
|