Since using , to build boxed arrays does not currently have any code to
support it, time is O(n^2). In other words: inefficient for long lists of
boxes.

So let's say we wanted to build lists of 30000 boxes, how could we do that
efficiently?

It seems to me that the right thing to do would be: pick a threshold (maybe
1000 boxes) and when your list gets that long, append that intermediate
result to a result list and start a fresh instance of the working list.
Repeat until done (and don't forget to append the last intermediate list to
the result).

Conceptually speaking, this is still O(n^2). But it should also be orders
of magnitude faster (at the cost of some complexity) than use of unadorned
comma. (And conceptually speaking one might be able to define some kind of
"infinite" representation of this algorithm which has better than O(n^2)
performance. Maybe O(n log n)?

Thanks,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to