[REBOL] Re: Line reduction - /direct ?
From: jelinem1::nationwide::com at: 5-Jul-2001 14:30
I have done some simple processing of large files (several megs) and I can
say that using /direct has a huge impact on performance, not only speed of
execution but also of memory consumption. Reading an entire file into
memory (esp as lines) costs alot.
- Michael
From: "Anton" <[arolls--bigpond--net--au]>@rebol.com on 07/05/2001 01:44 PM
Please respond to [rebol-list--rebol--com]
Sent by: [rebol-bounce--rebol--com]
To: <[rebol-list--rebol--com]>
cc:
Subject: [REBOL] Re: Line reduction - /direct ?
Try adding direct refinement:
read/direct/lines to-file input_file
> input_file: ask "Enter the source file name: "
> output_file: ask "Enter the output file name: "
> skip_amount: ask "Remove line after every X lines: "
> datafile: read/lines to-file input_file
>
> use [len skp] [
> len: length? datafile
> skp: 1 + to-integer skip_amount
> for rem len - (len // skp) skp (- skp) [
> remove at datafile rem
> ]
> ]
>
> write/lines to-file output_file datafile
Does it speed up?