Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

See this example, a function has Listable attributes often more efficient than Map,but why is this one is an exception?

With[{n = 6},
   IntegerDigits[Range[10^(n - 1), 10^n - 1]]
   ] // Hash // AbsoluteTiming
(*{1.573090, 756716557}*)

With[{n = 6},
   IntegerDigits /@ Range[10^(n - 1), 10^n - 1]
   ] // Hash // AbsoluteTiming
(*{0.202012, 756716557}*)
share|improve this question
add comment

1 Answer 1

up vote 9 down vote accepted

Map is autocompiling. If you turn autocompilation off, i.e., if you set

SetSystemOptions[
  "CompileOptions" -> "MapCompileLength" -> Infinity];

then the timings are the same.

Mathematica graphics

share|improve this answer
    
But you artificially made Map slower. –  Sasha Aug 19 '13 at 11:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.