Array under 1.2.8 was Re: Re: Sort by first part of line
[1/2] from: rotenca::telvia::it at: 8-Sep-2002 17:59
Hi Joel and all,
> I should have pointed out that the modified algorithm below splits
> the group number from the remainder of the line; therefore, some
> post-processing might be needed to re-attach the three-digit prefix
> to the data (unless, of course, the subsequent processing could use
> the bucket index for that purpose). So the time comparison may not
> be comletely fair.
This is a little true for all the test we made, someone use read/lines,
someone read, someone ends with a block of line, someone with a block of
blocks. More "exact" tests should be made with a file on disk and stop with a
file on disk.
A note, this does not work as one expect under 1.2.8:
buffer: copy/deep array/initial 999 [[]]
the correct expression under 1.2.8 is:
buffer: array/initial 999 []
copy/deep is no more useful, and series now are well initialized.
But the new array is too slow, here it is my patched version. I should like to
know if works without errors and/or if soemone finds others optimizations:
------code-----
array-patched: func [
[catch] ;PATCH: added
"Makes and initializes a series of a given size. patched by ana"
size [integer! block!] "Size or block of sizes for each dimension"
/initial "Specify an initial value for all elements"
value "Initial value"
/local block rest
][
if not initial [value: none]
if block? size [
rest: next size
if tail? rest [rest: none]
size: first size
if not integer? size [make error! "Integer size required"]
]
block: make block! size
either rest [
loop size [
;if series? value [value: copy/deep value] ;PATCH: removed
insert/only tail block throw-on-error [array/initial rest value]
;PATCH: added tail and throw-on-error
]
][
either series? value [
loop size [insert/only tail block copy/deep value] ;PATCH: added
tail
][
insert/dup block value size ;PATCH: removed block:
]
]
block ;PATCH: removed head
]
---
Ciao
Romano
[2/2] from: joel:neely:fedex at: 9-Sep-2002 10:14
Hi, Romano,
Romano Paolo Tenca wrote:
> > I should have pointed out that the modified algorithm below
> > splits the group number from the remainder of the line;
<<quoted lines omitted: 6>>
> someone with a block of blocks. More "exact" tests should be
> made with a file on disk and stop with a file on disk.
Or else perform all tests beginning with a block of lines as
obtained from input (or the previous process) and ending with a
block of properly-orginazed lines.
That way we'd have comparisons of only the block rearrangement,
and not mix in I/O overhead (which would likely vary from box to
box anyway).
> A note, this does not work as one expect under 1.2.8:
>
I was running under Core 2.5; since View is not (yet?) supported
on Mac OS/X, I'm sticking with the version that I can actually
use on all platforms I regularly use.
-jn-
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted