im using Map on a List like this:
cube= {{1, 1, 1}, {1, 1, 2}, {1, 1, 3}, {1, 1, 4}, ... , {5, 5, 4}, {5, 5, 5}}
Mapping the whole List with 125 entries takes like 2.5s.
AbsoluteTiming[
Map[Apply[d[[#1, #2, #3]] &, #] &, cube];
]
{2.552146, Null}
Mapping in two sublists with less than 100 entries the whole thing takes nearly no time.
AbsoluteTiming[
Join[
Map[Apply[d[[#1, #2, #3]] &, #] &, cube[[1 ;; 99]]],
Map[Apply[d[[#1, #2, #3]] &, #] &, cube[[100 ;; 125]]]
];
]
{0., Null}
Why is there a huge performance gap? An how do I avoid it except splitting my list?


cubeis equal toTuples[Range[5],3], just so you know :). – Teake Nutma Jul 16 '14 at 10:56...here really means{2,9,12},{tweedledee,tweedledum, "tweedleDUN"}. This reminds me of a book by a mathematician I once read which pointed out a remarkable device that physicists have come up with, namely, $\ldots$, which allows them to solve practically any problem simply by omission. – acl Jul 16 '14 at 11:04dis? and isn't this the same :Map[d[[Sequence @@ #]] &, cube]? I cant reproduce this slowness even on much larger lists. – george2079 Jul 16 '14 at 15:13