[REBOL] Re: Rugby and large data
From: m:koopmans2:chello:nl at: 1-Feb-2002 12:11
The problem is that Rugby tries to compress the *complete* message before
sending it. Which takes a lot of memory/time.
Another approach might be to read the file in parts,
i.e. a function get-part: func [ f [file!] start-byte [integer!] end-byte
[integer!]][...]
See also the read/binary/skip/part function.
If you are doing a file-sharing in a P2P network this has the added benefit
that you can collect different parts of a file from different servers
concurrently. The client can then reassemble these parts. This is what
Morpheus etc. do.
If you use /deferred to collect the file parts you can do something like:
deferred-msgs: [] ; this is a block where you stored the /deferred ticket
numbers when doing the requests
fileparts: copy []
until
[
repeat entry deferred-msgs
[
if result-available? entry
[
append fileparts entry
append fileparts get-result entry
remove find deffered-msgs entry
]
]
empty? deffered-msgs
]
;Now disassemble the fileparts yourself
HTH,
Maarten