Subject: RE: Efficently transposing tokenized data
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 5 Nov 2008 14:54:37 -0000
|
> Assuming a large input, your approach looks more efficient to
> me as it avoids grouping where indexing into the list does the job.
>
> Now I guess from previous answers on this list given to
> similar questions that this is all implementation-defined.
>
> In spite of this, I'm asking whether that is all that can be
> said here or whether there is a rationale here to favor
> indexing over grouping when (a) processing time or (b) memory
> consumption are important?
In Saxon (a) grouping will actually build a hash table in memory, so it uses
more memory, and (b) indexing in the form $seq[integer] is a constant-time
operation, so the indexing approach should definitely be better.
Michael Kay
http://www.saxonica.com/
|