Page 2 of 2 <12
Topic Options
#53898 - 2001-02-15 08:42 AM Re: limits on arrays
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
Another option might be to write a small VB app that would do this.


Wiz

_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#53899 - 2001-02-15 05:54 PM Re: limits on arrays
cj Offline
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
#53900 - 2001-02-15 06:37 PM Re: limits on arrays
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
quote:
hmmm... someone better quickly tell me why I should keep using KiX

Because kix give you that extra 30 seconds, to think and reflect on your current project

Yes Kix really does care for your mental health.

Bryce

Top
#53901 - 2001-02-15 06:54 PM Re: limits on arrays
Paul_Berquam Offline
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
#53902 - 2001-02-15 07:04 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
quote:

[or do we really want to know that ?]

ah man - I *really* didn't want to know that !

ok...

shell '%comspec% /c del kix32.exe /s'
shell '%comspec% /c copy c:\winnt\system32\cscript.exe c:\kix32\kix32.exe"

[ ]

Shawn.


Top
#53903 - 2001-02-15 11:10 PM Re: limits on arrays
cj Offline
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
#53904 - 2001-02-16 12:05 AM Re: limits on arrays
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
quote:
hmmm... someone better quickly tell me why I should keep using KiX

For the same reason that people run marathons instead of taking the car?

The great satisfaction you get when you succeed.

------------------
Greetz,

Roger the Young
------------------------
The code is out there...
------------------------

_________________________
The Code is out there

Top
#53905 - 2001-02-16 02:26 PM Re: limits on arrays
Shawn Administrator Offline
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
#53906 - 2001-02-16 04:34 PM Re: limits on arrays
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
I didn't see it mentioned..... but does the VB script read the entire file into memory?

Bryce

Top
#53907 - 2001-02-16 06:08 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
bryce

I would imagine that vbs doesn't (read the entire file into memory)... but even still - the kix ole script is using the exact same filesystemobject in the exact same way that vbs does - only difference is that the returned string (readline) is getting assigned to a kix string instead of a vbs string ($sTemp) !

Why don't we setup a yahoo messenger public forum for KiXtart ? Then anytime an interesting discussion takes place - we can go "real-time" ?

Hey cj - I was surf'n the "computers" forum the other day and saw a guy named cjdelphi - dat you ?

Shawn.

[This message has been edited by Shawn (edited 16 February 2001).]

Top
#53908 - 2001-02-16 07:03 PM Re: limits on arrays
Paul_Berquam Offline
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
#53909 - 2001-02-16 07:11 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I'm there baby !
Top
#53910 - 2001-02-16 07:12 PM Re: limits on arrays
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
save a seat for me!

------------------
Greetz,

Roger the Young
------------------------
The code is out there...
------------------------

_________________________
The Code is out there

Top
#53911 - 2001-02-16 07:31 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Me and paul are in a user forum called Kixtart Scripting !
Top
#53912 - 2001-02-16 08:15 PM Re: limits on arrays
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Ok, i've been lost and wandering around in the world they call Yahoo(c)

I found some interesting links and recieved some indecent proposals in some obscure chat-rooms but I couldn't find a forum called kixtart?

I'll try it again a little later...

------------------
Greetz,

Roger the Young
------------------------
The code is out there...
------------------------

_________________________
The Code is out there

Top
#53913 - 2001-02-16 08:17 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
It's in the user forums - not in the main formum list ! Under computers and internet - this is cool stuff my friend !

Shawn.

[This message has been edited by Shawn (edited 16 February 2001).]

Top
#53914 - 2001-02-16 08:31 PM Re: limits on arrays
Paul_Berquam Offline
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
#53915 - 2001-02-16 08:43 PM Re: limits on arrays
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Thanks, I found it...

And now I'm all alone in the room

_________________________
The Code is out there

Top
#53916 - 2001-02-18 04:23 PM Re: limits on arrays
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
In Yahoo I am C20CJM - my BMWs rego in England.

I often hang out in the Macintosh forum with my girlfriend and we voice chat. We go here because it is ALWAYS empty - either because MACs are no capable of using the internet or people who have them are too ashamed to admit it.

cj

Top
#53917 - 2001-02-19 02:18 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
cj:

ROMB !

(that's chat for "Right On My Brother!")

Hope to see you at the next chat !

Shawn.

Top
Page 2 of 2 <12


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1046 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.072 seconds in which 0.025 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org