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
[11607]
but in fact, you should execute it several times, results can be 
different
BrianH
18-Dec-2008
[11608]
Particularly on Windows.
Steeve
18-Dec-2008
[11609x4]
in fact you can see that 16ko buffer would be a better choice (regarding 
to the first column)
(the third column)
you must do more tests
brb, i have to request some cigarettes and food
[unknown: 5]
18-Dec-2008
[11613]
Steeve, I'm finding that copy/part using 'at on /seek is working 
at more speed for me.
Steeve
18-Dec-2008
[11614]
you must have a special computer, it's not quiet logical and i have 
opposite results on my computer
[unknown: 5]
18-Dec-2008
[11615x2]
s: now/precise
a: open/direct/binary %blah
idx: 0
a/state/index: 0
buff: make binary! 16

loop 100000 [read-io a buff 16 a/state/index: a/state/index + 16 
clear buff]
close a
t: now/precise
difference t s
my datafile is %blah
Steeve
18-Dec-2008
[11617]
oh really ? ;-)
[unknown: 5]
18-Dec-2008
[11618x5]
== 0:00:01.934
That is what I get with read-io.
s: now/precise
a: open/seek %blah
idx: 0
loop 100000 [copy/part at a (idx: idx + 16) 16]
close a
t: now/precise
difference t s
what I get with copy/part:
== 0:00:01.747
Steeve
18-Dec-2008
[11623x2]
using a buffer of 16 bytes is YOUR problem, didn't you understand 
the result of the pofiling script
use a 16ko buffer instead (16ko = 16 * 1024)
[unknown: 5]
18-Dec-2008
[11625]
Yes, I did Steeve, but that is my point - I'm saying for MY purposes 
read-io i s not faster.
Oldes
18-Dec-2008
[11626]
Do you mean you MUST use only 16 bytes?
Steeve
18-Dec-2008
[11627]
but copy use a larger buffer that 16 bytes, you don't compare same 
things
[unknown: 5]
18-Dec-2008
[11628x3]
I'm comparing the same for what I need.
I only need to copy 16 bytes
Yes Oldes
Steeve
18-Dec-2008
[11631]
no you are wrong Paul, copy is using an internal buffer of the port 
which are of several Kbytes
[unknown: 5]
18-Dec-2008
[11632x2]
Steeve, your missing what I'm saying.
I ONLY WANT to read 16bytes.  I don't want any more than that.
Steeve
18-Dec-2008
[11634]
not really
[unknown: 5]
18-Dec-2008
[11635]
heh,ok Steeve, what do I really want?
Steeve
18-Dec-2008
[11636]
i think it's you who don't understand, but anyway do as you want
[unknown: 5]
18-Dec-2008
[11637]
ok steeve.
BrianH
18-Dec-2008
[11638]
Paul, the data you are retrieving is in 16 byte increments and not 
contiguous?
[unknown: 5]
18-Dec-2008
[11639]
Correct Brian.
BrianH
18-Dec-2008
[11640]
Accessed randomly, not in order?
[unknown: 5]
18-Dec-2008
[11641x2]
Yes.
I'll use read-io for my contigious stuff but not for this portion
Steeve
18-Dec-2008
[11643]
each time you do a copy/part a new internal buffer is created, it's 
better to use always the same buffer. easy to understand.

more of that, the profiling script say that it''s faster to read 
16ko than 2 times  16 bytes
BrianH
18-Dec-2008
[11644]
In that case, read-io would not work well for you directly without 
implementing your own buffering. Barring that, the buffering built 
into REBOL and used by COPY would probably be good enough. If yo 
want better performance you might to make your own buffers.
[unknown: 5]
18-Dec-2008
[11645x2]
Steeve, why should I read 16k  when I only want 16 bytes?  I would 
then have to copy/part on the  portion of the buffer that I want 
if that was the case to get only the first 16 bytes of the 16k.
Correct Brian.
BrianH
18-Dec-2008
[11647]
You would have some memory overhead if you go the COPY route because 
of what Steeve said, but that may be dwarfed by the disk overhead 
savings.
[unknown: 5]
18-Dec-2008
[11648x2]
correct.
its the speed of the read which will be the most  impact.
Steeve
18-Dec-2008
[11650]
because each time you do a copy/part you create new buffers in memory 
which are not erased by the recycler so that you should consider

using always the same buffer especially if you do thousands and thousands 
access in one second
[unknown: 5]
18-Dec-2008
[11651]
I would still have to use copy/part on the buffer if I went with 
Steeves idea.
BrianH
18-Dec-2008
[11652]
You would get better performance improvements by figuring out how 
to queue your reads so you get better disk locality, which would 
lead to better internal buffer usage.
[unknown: 5]
18-Dec-2008
[11653]
But you don't get it Steeve, I would still be using copy/part on 
the buffer filled by your read-io to get just the 16 bytes I want.
Steeve
18-Dec-2008
[11654]
memory overhead is the point
[unknown: 5]
18-Dec-2008
[11655]
performance is the point.
BrianH
18-Dec-2008
[11656]
Not in this case, Steeve.