Group Abstract Group Abstract

Message Boards Message Boards

0
|
15.7K Views
|
8 Replies
|
8 Total Likes
View groups...
Share
Share this post:

Mathematica 10 twice as slow as Mathematica 8 -Reap and Sow is all it takes

Posted 12 years ago

Trimmed my code to the critical section - Reap and Sow

10.0 for Microsoft Windows (64-bit) Session=1.5340877 Absolute=1.531088 Time=0.842405

8.0 for Microsoft Windows (64-bit) Session=0.7360421 Absolute=0.7340420 Time=0.359

8.0 for Microsoft Windows (64-bit) Session=0.7530431 Absolute=0.7530431 Time=0.328

10.0 for Microsoft Windows (64-bit) Session=1.5580891 Absolute=1.555089 Time=0.702005

data = Reap[Do [Sow[Range[i^2]~Partition~i,{i,1000}]];

Notebook with driver attached. I had to type the line in because Chrome locks up on every "Paste" of code.

Attachments:
POSTED BY: Douglas Kubler
8 Replies

Not a misprint; I tested all three versions on the same machine. Notice that I changed the problem so as to use integers larger than 32 bit but smaller than 64. This means that version 8 cannot work with packed arrays whereas the later versions can do so.

POSTED BY: Daniel Lichtblau

I am seeing very little diffference between versions 9 and 10 on 64 bit platforms. Likewise on the 32 bit machine I checked.

To elaborate on the point made by Ilian, enlarging the size of the integers to the 32-64 bit range shows a markedly different behavior.

Clear[data];Clear[data];
now = SessionTime[];
abs = AbsoluteTiming[
   tim = Timing[
      data = Reap[
         Do[Sow[Partition[Range[i^2]^2,i]], {i, 1000}]
         ];
      ];
   ];
ver = StringTake[$Version, StringPosition[$Version, ")"][[1, 1]]];
Print[ver, " Session=", SessionTime[] - now, " Absolute=", abs[[1]], 
  " Time=", tim[[1]]];
ByteCount[data]
Clear[data

]

In versions 9 and 10 this takes around 6 seconds. In version 8 it takes 120 seconds.

POSTED BY: Daniel Lichtblau
Posted 12 years ago

"In versions 9 and 10 this takes around 6 seconds. In version 8 it takes 120 seconds."

Is that a misprint or are you referring to M8 on a very slow machine?

POSTED BY: Douglas Kubler
POSTED BY: Ilian Gachevski
Posted 12 years ago

You're right that M8 is 32-bit. In fact the ByteCount[data] confirms it. I was focused on problems with the system running out of physical memory, hence the need for Clear[data]. The system can appear to freeze on successive runs when using virtual memory.

POSTED BY: Douglas Kubler
Posted 10 years ago

Hello all, how can I run a notebook created in mathematica 8, in a win7 64bit pc with mathematica 10.3, in 32 bit and not 64 bit? M10 seems indeed much slower than M8.

Thank you in advance

POSTED BY: Tom Zinger

I think this is just because V9 and later uses 64-bit machine integers, so there is twice as much data to handle compared to V8 which is limited to 32-bit machine integers even on 64-bit platforms.

What would be the timing if this example were run in the 32-bit Windows kernel (found under Mathematica\10.0\SystemFiles\Kernel\Binaries\Windows\MathKernel.exe)?

POSTED BY: Ilian Gachevski
Posted 12 years ago

My investigation started with an M9 program that I benchmarked and published on RosettaCode.org. After I installed M10 (and uninstalled M9 in the process) the program was much slower. The facts are clear. M10 is slower. M10 needs a fix. If you have a 32 bit kernel go ahead and test.

POSTED BY: Douglas Kubler
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard