Skip to main content
fix minor typos
Source Link
Itai Seggev
  • 14.3k
  • 61
  • 85

A couple of general points before I delve into the specifics of this question

  1. There will always be some OS difference in behavior and performance, even on the same hardware. We hook into OS APIs where appropriate, and we generally use native system compilers. Thus, if there are real differences between compilers, they might appear in the product (and we might have to work around them, if there are serious bugs).

  2. TimingTiming has platform dependent behavior, and in particular is appropriateinappropriate for performance testing, because it is measuring "time spent on the CPU" which is defined differently on different platforms. On Windows, it is, I think, the largest time spent by any single core on the CPU. On Unix, it is the sum total of the times spent by each core. You can verify this by comparing Timing with AbsoluteTimingAbsoluteTiming, which returns wall-clock time:

    In[170]:= a = RandomReal[{0, 1}, {1000, 2000}]; b = RandomReal[{0, 1}, {2000, 3000}]; Timing[a.b;] Out[172]= {0.38635, Null}

    In[173]:= a = RandomReal[{0, 1}, {1000, 2000}]; b = RandomReal[{0, 1}, {2000, 3000}]; AbsoluteTiming[a.b;] Out[175]= {0.106865, Null}

My MBP has 4 cores, and returns approximately 1/4 wall-clock time as CPU time, becuase matrix multiplication parallelizes very well. I'm guessing that on your Mac Mini you had 4 cores, so your factor 10 was really a factor of 2.5.

Now, why was Version 9 about 20% slower overall on OS X than Windows? I don't know very specifically, although I can reproduced that on my MBP. OTOH, Version 11.1 runs faster on OS X than Windows. Version 9 coincides with the period Apple head ceased developing GCC and was working to make clang a viable alternative to it. So probably Version 9 was slower on Mac simply because it was using an older compiler which didn't have as many optimizations.

A couple of general points before I delve into the specifics of this question

  1. There will always be some OS difference in behavior and performance, even on the same hardware. We hook into OS APIs where appropriate, and we generally use native system compilers. Thus, if there are real differences between compilers, they might appear in the product (and we might have to work around them, if there are serious bugs).

  2. Timing has platform dependent behavior, and in particular is appropriate for performance testing, because it is measuring "time spent on the CPU" which is defined differently on different platforms. On Windows, it is, I think, the largest time spent by any single core on the CPU. On Unix, it is the sum total of the times spent by each core. You can verify this by comparing Timing with AbsoluteTiming, which returns wall-clock time:

    In[170]:= a = RandomReal[{0, 1}, {1000, 2000}]; b = RandomReal[{0, 1}, {2000, 3000}]; Timing[a.b;] Out[172]= {0.38635, Null}

    In[173]:= a = RandomReal[{0, 1}, {1000, 2000}]; b = RandomReal[{0, 1}, {2000, 3000}]; AbsoluteTiming[a.b;] Out[175]= {0.106865, Null}

My MBP has 4 cores, and returns approximately 1/4 wall-clock time as CPU time, becuase matrix multiplication parallelizes very well. I'm guessing that on your Mac Mini you had 4 cores, so your factor 10 was really a factor of 2.5.

Now, why was Version 9 about 20% slower overall on OS X than Windows? I don't know very specifically, although I can reproduced that on my MBP. OTOH, Version 11.1 runs faster on OS X than Windows. Version 9 coincides with the period Apple head ceased developing GCC and was working to make clang a viable alternative to it. So probably Version 9 was slower on Mac simply because it was using an older compiler which didn't have as many optimizations.

A couple of general points before I delve into the specifics of this question

  1. There will always be some OS difference in behavior and performance, even on the same hardware. We hook into OS APIs where appropriate, and we generally use native system compilers. Thus, if there are real differences between compilers, they might appear in the product (and we might have to work around them, if there are serious bugs).

  2. Timing has platform dependent behavior, and in particular is inappropriate for performance testing, because it is measuring "time spent on the CPU" which is defined differently on different platforms. On Windows, it is, I think, the largest time spent by any single core on the CPU. On Unix, it is the sum total of the times spent by each core. You can verify this by comparing Timing with AbsoluteTiming, which returns wall-clock time:

    In[170]:= a = RandomReal[{0, 1}, {1000, 2000}]; b = RandomReal[{0, 1}, {2000, 3000}]; Timing[a.b;] Out[172]= {0.38635, Null}

    In[173]:= a = RandomReal[{0, 1}, {1000, 2000}]; b = RandomReal[{0, 1}, {2000, 3000}]; AbsoluteTiming[a.b;] Out[175]= {0.106865, Null}

My MBP has 4 cores, and returns approximately 1/4 wall-clock time as CPU time, becuase matrix multiplication parallelizes very well. I'm guessing that on your Mac Mini you had 4 cores, so your factor 10 was really a factor of 2.5.

Now, why was Version 9 about 20% slower overall on OS X than Windows? I don't know very specifically, although I can reproduced that on my MBP. OTOH, Version 11.1 runs faster on OS X than Windows. Version 9 coincides with the period Apple head ceased developing GCC and was working to make clang a viable alternative to it. So probably Version 9 was slower on Mac simply because it was using an older compiler which didn't have as many optimizations.

Source Link
Itai Seggev
  • 14.3k
  • 61
  • 85

A couple of general points before I delve into the specifics of this question

  1. There will always be some OS difference in behavior and performance, even on the same hardware. We hook into OS APIs where appropriate, and we generally use native system compilers. Thus, if there are real differences between compilers, they might appear in the product (and we might have to work around them, if there are serious bugs).

  2. Timing has platform dependent behavior, and in particular is appropriate for performance testing, because it is measuring "time spent on the CPU" which is defined differently on different platforms. On Windows, it is, I think, the largest time spent by any single core on the CPU. On Unix, it is the sum total of the times spent by each core. You can verify this by comparing Timing with AbsoluteTiming, which returns wall-clock time:

    In[170]:= a = RandomReal[{0, 1}, {1000, 2000}]; b = RandomReal[{0, 1}, {2000, 3000}]; Timing[a.b;] Out[172]= {0.38635, Null}

    In[173]:= a = RandomReal[{0, 1}, {1000, 2000}]; b = RandomReal[{0, 1}, {2000, 3000}]; AbsoluteTiming[a.b;] Out[175]= {0.106865, Null}

My MBP has 4 cores, and returns approximately 1/4 wall-clock time as CPU time, becuase matrix multiplication parallelizes very well. I'm guessing that on your Mac Mini you had 4 cores, so your factor 10 was really a factor of 2.5.

Now, why was Version 9 about 20% slower overall on OS X than Windows? I don't know very specifically, although I can reproduced that on my MBP. OTOH, Version 11.1 runs faster on OS X than Windows. Version 9 coincides with the period Apple head ceased developing GCC and was working to make clang a viable alternative to it. So probably Version 9 was slower on Mac simply because it was using an older compiler which didn't have as many optimizations.