r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Steeve
18-Dec-2008
[11532x6]
Paul, it's just using port/state/index is theoricaly faster than 
at (because at is a wrapper)
internally 'at uses port/state/index
you can  see the source (i don't remember where)
iirc
the most annoying overhead comes from the wrapper of the copy func.
you should use read-io instead of, if you want very fast access
read-io and write-io use correctly the port/state/index, just don't 
forget that port/state/index is zero based (seems to be a bug)
[unknown: 5]
18-Dec-2008
[11538x2]
Steeve, yeah I would assume that is the case.  So the difference 
your seeing in performance is really just a small one as a result 
of the 'at then being a wrapper?
I'm might do some tests here to see myself
Steeve
18-Dec-2008
[11540]
agreed it's a small overhead concerning at, but not concerning copy 
(see the source if you find it)
[unknown: 5]
18-Dec-2008
[11541]
source for what?
Steeve
18-Dec-2008
[11542]
source for the file port handler, ok i'm looking for it....
BrianH
18-Dec-2008
[11543]
You can't see the source of the file port handler.
Steeve
18-Dec-2008
[11544]
in the past i found something...
BrianH
18-Dec-2008
[11545]
It's native code.
Steeve
18-Dec-2008
[11546]
perhaps it's the scheme to be exact
BrianH
18-Dec-2008
[11547]
You might be thinking of one of these:
>> first system/schemes

== [self default Finger Whois Daytime SMTP ESMTP POP IMAP HTTP FTP 
NNTP HTTPS]
[unknown: 5]
18-Dec-2008
[11548x2]
So what you really mean Steeve is that read-io is faster than copy 
correct?
That would make sense since read-io is lower level
Steeve
18-Dec-2008
[11550]
i think it is
[unknown: 5]
18-Dec-2008
[11551]
I never check to see how significant the difference was though.  
I might try  a test on a million records or so
BrianH
18-Dec-2008
[11552]
I have got to backport the R3 profiling functions to R2 :(
[unknown: 5]
18-Dec-2008
[11553x2]
Would be nice Brian but I got good ole stats/evals
speaking of backporting is 2.7.6 the end or is 2.7.7 still a possibility?
BrianH
18-Dec-2008
[11555x2]
Further R2 releases will wait until after the R3 developer release, 
but they are coming.
The R3 profiling functions are wrappers around the R3 stats, so I 
just have to translate that to the R2 stats.
Steeve
18-Dec-2008
[11557]
i think that in the past i saw the  source of the file-handler even 
if i can't find it anymore in my sources.

i have the sources of the handlers of other shemes in some proto 
scripts delivred with the commercial version of view.
But nothing else... i loose my memory...
[unknown: 5]
18-Dec-2008
[11558x3]
read-io shouldn't be used with /seek it appears.
in fact they should make it so that  it CAN'T be.
need it to throw an error  or something.
Steeve
18-Dec-2008
[11561]
why ? i use it with /seek as well
[unknown: 5]
18-Dec-2008
[11562x14]
how many characters do you attempt to read each time?
seems with see you only get 15 characters to fill the buffer
see = seek
pass it a greater number and it will still only return 15
works ok with direct though
I think I ran into this problem before
Gonna check Rambo.
Ahhhh, I see.  I just discovered something.
Looks like an empty string is about 16 bytes
Better becareful to size your buffer when using read-io.
It doesn't expand beyond a default of 15 characters unless you define 
it as such.
So in other words if you set your bufrer as just:
buffer: "" then you going to only get 15 chars back.
So instead you need to define it as large as needed:
BrianH
18-Dec-2008
[11576]
Well, at least it doesn't overflow :)
[unknown: 5]
18-Dec-2008
[11577x2]
buffer: make string! 1024
Yeah true Brian, and maybe that is why.
Steeve
18-Dec-2008
[11579]
i give you a script i used to profile the ideal size of the buffer 
used with read-io to have the best perfs.
On my computer the best size for the buffer is 8ko or 16ko.

REBOL []
f: open/seek/binary %large.dta

foreach len [64 128 256 1024 2048 4096 8192 10240 16384 32768 65536 
131072] [

	f/state/index: 0		;*** Problème quand on emploie read-io :
					;*** apparement c'est un bug, par défaut l'index est à 1
					;*** du coup, le premier octet n'est jamais lu
	

 buff: make binary! len + 1	;*** Encore un bizarerie, si le buffer 
 a exactement
					;*** la taille voulue, read-io lit un octet de moins
	n: 0
	recycle
	t: now/time/precise

 while [0 < read-io f buff len] [n: n + 1 clear buff f/state/index: 
 f/state/index + len]
	print [len tab v: now/time/precise - t tab v / n tab n]
]

close f
halt
[unknown: 5]
18-Dec-2008
[11580x2]
See your declaring the size of your buffer so wouldn't have seen 
the other problem.
you don't need the /binary switch with seek in 2.7.6