Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kschendel

macrumors 65816
Dec 9, 2014
1,308
587
FWIW, running this test on a Ryzen 5800X (which is in general a bit faster than any Intel less than 12th gen) gives me 0.1 seconds at 20, 3 seconds at 25, and 105 seconds at 30. That's on linux with perl 5.36.

The fact that you got identical times with an i9 and an m1 is almost certainly just a bizarre coincidence.

The m1 is in general a better balance of performance and power than any Intel chip. If your argument is "Apple told us the m1 is faster than anything and it's not", then all I can say is maybe you shouldn't take marketing claims at literal face value.
 

mr_roboto

macrumors 6502a
Sep 30, 2020
856
1,866
By the way, I dunno if anyone else noticed, but the graph in the original post is a classic example of how to lie with data. @chars1ub0w used a log scale on the vertical axis to compress the two curves much closer together than they would appear in a linear scale graph. Even his own data probably supports M1 being substantially faster than his i9, it just looks much closer than it is thanks to the log scale compression making the data points look closer together than they really are.

Note: If anyone goes back to take a look at that graph, please ignore the first three data points for N=5, 10, and 15. At these low values of N, the regex execution time is so short that it's lost in the random noise of Perl interpreter startup time (which seems to vary quite a bit from run to run) and the UNIX 'time' command's measurement accuracy.

Also: If you step through some sequences of N that are a bit closer together, it quickly becomes evident that execution time roughly doubles each time you increment N by 1, meaning this very weird regex is running in O(2^N) time on many of these regex engines. (Not all - the data @leman collected for R's regex engine still looks like some kind of fast growing curve, but clearly it's not 2^N unless I'm misunderstanding the axes.) This is why this is a bad test of real world performance; nobody actually uses weird regex patterns crafted only to demonstrate that regex engines have edge cases with exponential execution time growth.
 
  • Haha
  • Like
Reactions: leman and dgdosen

leman

macrumors Core
Oct 14, 2008
19,521
19,674
By the way, I dunno if anyone else noticed, but the graph in the original post is a classic example of how to lie with data. @chars1ub0w used a log scale on the vertical axis to compress the two curves much closer together than they would appear in a linear scale graph. Even his own data probably supports M1 being substantially faster than his i9, it just looks much closer than it is thanks to the log scale compression making the data points look closer together than they really are.

Note: If anyone goes back to take a look at that graph, please ignore the first three data points for N=5, 10, and 15. At these low values of N, the regex execution time is so short that it's lost in the random noise of Perl interpreter startup time (which seems to vary quite a bit from run to run) and the UNIX 'time' command's measurement accuracy.

Also: If you step through some sequences of N that are a bit closer together, it quickly becomes evident that execution time roughly doubles each time you increment N by 1, meaning this very weird regex is running in O(2^N) time on many of these regex engines. (Not all - the data @leman collected for R's regex engine still looks like some kind of fast growing curve, but clearly it's not 2^N unless I'm misunderstanding the axes.) This is why this is a bad test of real world performance; nobody actually uses weird regex patterns crafted only to demonstrate that regex engines have edge cases with exponential execution time growth.

Thank you! I was getting desperate here. By the way, I did some tests using real-world regexes with Perl and M1 is 60-70% faster than Intel mobile i9 Coffee Lake (post #55 has more details).

P.S. I can’t believe that I didn’t immediately jump at the fact that the scale is logarithmic… must be getting overworked…
 
Last edited:

sam_dean

Suspended
Sep 9, 2022
1,262
1,091
I don't think its about not being able to afford it....

I can run out get 8k machine. What can it do for me?

how can it help my work flow?

If I make that type of investment. Macs last a long time. Pro machines are supposed to last longer. I don't need apple to limit the life of my investment.

Chip vs Chip is just a sliver of the pie. As a machine ages, software size grows. Fast ram is good. More ram is better. I've seen more speed improvements with Ram and HD and Video Card upgrades then the CPU.

Apple Silicon replaces, GPU, RAM upgrades with locked in pure performance. But If I buy a fast machine now, it needs more ram later im stuck. Virtual Memory on the HD is going to slow it down where, just going to have to buy a new machine.

Mac Studio, they choose to use proprietary HD's.

Now I've been a Mac user for 30+ years. I been though the 68k to PPC change PPC change to intel. All of them had upgrade paths. They had upgrades turn a 68k mac into a PPC. My three longest lasting macs Powermac 8500. dual g4 upgrade. Powermac g4 with a dual 1.4ghz upgrade. & Mac pro 2009 with a 12 core 3.46 chips.

My worse purchase was mac pro 2013 I bought in 2018. I needed that machine for software for work. Apple killed support for Ventura. I went to do a trade in for a Mac studio.

They offered to Recycle it. What a nice company lol. I should of waited a year and half for the 2019 mac pro. I couldn't.

Apple needs to be pressured to offer upgrade paths for pro machines. Every-time i go into the Apple store, I remind them why entertainment industry is moving away from apple. Mac Pro 2019 was a comeback, I'm waiting for new Mac Pro see what they do.


Your situation is unfortunate but from the way Apple, pundits, customers and end users have explained it Apple Silicon would not be able to squeeze every ounce of performance out of the hardware if Apple continued the old way of how everyone else is doing business.

And it shows with all the multitudes of benchmarks.

Upgrades introduces bottlenecks inherent to the physical distance between hardware to hardware. This impacts overall raw performance.

Best way to explain it would be like how a human city is built.

The most efficient cities are built to have all key infrastructure as close to the people as possible or even on site. So in terms of travel distance & time it is as short as possible.

Inefficient cities are designed to be sprawling with key infrastructure being only accessible via car on roads without alternatives of say a bus, or rail-based mass rapid system.

You can see this whenever looking at a logic board of a PPC vs Intel vs Apple Silicon.

I saw the logic board of a 2021 iMac 24" M1 and it is almost as tiny as that of an iPhone.

With the Mac Studio I think the target customer are those who never used the PCIe slots of the Mac Pro but want the raw performance. That's people like me.

Yes, I wish the memory & internal storage were user upgradable but I also wish they put in a Compact Flash card reader rather than a SD card reader. Why? Because I still use the highest-end Canon EF bodies marketed from 2009-2015. Yes, highest-end Canon RF bodies from 20220-onward use CFexpress B cards but I do not use em.

SD cards to me is a low-end annoyance but that's the most popular memory card for YouTubers and Sony users.

Yes, I wish the memory upgrades they offered were at most 2x the cost of 3rd party RAM or Apple standardised 2x the base memory & base storage of any Mac at the current price points.

So with your use case Mac Pro may be for you.

I have a 2002 Power Mac G4 and I never used the daughter board slots. I even wished I bought the highest-end 2022 iMac G4 20" but with the CPU & GPU of the Power Mac as that is what I wanted.

Mac Studio's a dream for me and merits its price point if only Apple's desktop SoCs had a higher power input rather than identical to all the laptops.

In other words why couldn't Apple overclock the M1 Max & M1 Ultra considering it is a desktop with an overpowered active heat sink fan so power draw isn't that much of a concern.

As for your 2018 purchase of the 2013 Mac Pro I am sympathetic to you but this forum's Buyers Guide and other resources would all point to that Mac Pro nearing its end of life. I believe as early as 2yrs prior to the 2019 model's release rumours were there for it.

Reminds me of myself when I bought the 2019 MacBook Pro 16" 14nm. There were rumours of a Apple Silicon Mac coming out weeks prior to my purchase. In my mind I was expecting a ~20% improvement so it would be cost effective for Apple and not worth the wait.

It did not dawn on me the impact of Apple using the same 5nm die shrink as the iPhone translating to >80% improvement on the Mac of everything and anything anyone could think of. Why? Because it has never been done that way before.

Apple, like all brands, will produce products people will want to buy. The Mac Pro you want will be available but because so few people want the old way of PC-style upgrade paths it will be at such a lower volume than a Mac Studio but at a price point anyone would cry over.

Businesses buying this will look at this at a total cost of ownership point of view rather than initial cost like what most consumers will be doing.
 
Last edited:

dgdosen

macrumors 68030
Dec 13, 2003
2,817
1,463
Seattle
By the way, I dunno if anyone else noticed, but the graph in the original post is a classic example of how to lie with data. @chars1ub0w used a log scale on the vertical axis to compress the two curves much closer together than they would appear in a linear scale graph. Even his own data probably supports M1 being substantially faster than his i9, it just looks much closer than it is thanks to the log scale compression making the data points look closer together than they really are.

Note: If anyone goes back to take a look at that graph, please ignore the first three data points for N=5, 10, and 15. At these low values of N, the regex execution time is so short that it's lost in the random noise of Perl interpreter startup time (which seems to vary quite a bit from run to run) and the UNIX 'time' command's measurement accuracy.

Also: If you step through some sequences of N that are a bit closer together, it quickly becomes evident that execution time roughly doubles each time you increment N by 1, meaning this very weird regex is running in O(2^N) time on many of these regex engines. (Not all - the data @leman collected for R's regex engine still looks like some kind of fast growing curve, but clearly it's not 2^N unless I'm misunderstanding the axes.) This is why this is a bad test of real world performance; nobody actually uses weird regex patterns crafted only to demonstrate that regex engines have edge cases with exponential execution time growth.

I'm still laughing at this... You watch/read a futurist like Ray Kurzweil and he always talks about how humans have trouble comprehending a concept like exponential growth - and he demonstrates with graphs on a logarithmic scale...

Such opposite.
 

throAU

macrumors G3
Feb 13, 2012
9,198
7,350
Perth, Western Australia
And you would be wrong on both counts. M1 has more cache, almost double the integer processing units and superior branch prediction.

And? Those things are to help efficiency at lower power.

It wasn’t designed for ultimate high end performance as it runs in under 100 watts total system power. Including a GPU that’s actually not crap.

It’s clocked much lower than an i9 and uses far less power.

If Apple was shooting for the ultimate performance with it they’d be clocking it higher and giving it a much larger power budget.

We shall hopefully see this when they put out a pro machine they aren’t containing to 100 watts.
 
Last edited:

quarkysg

macrumors 65816
Oct 12, 2019
1,247
841
By the way, I dunno if anyone else noticed, but the graph in the original post is a classic example of how to lie with data. @chars1ub0w used a log scale on the vertical axis to compress the two curves much closer together than they would appear in a linear scale graph. Even his own data probably supports M1 being substantially faster than his i9, it just looks much closer than it is thanks to the log scale compression making the data points look closer together than they really are.
So we'll have wait for the next poster to come along and stir up another controversy I guess.

And? Those things are to help efficiency at lower power.

It wasn’t designed for ultimate high end performance as it runs in under 100 watts total system power. Including a GPU that’s actually not crap.

It’s clocked much lower than an i9 and uses far less power.

If Apple was shooting for the ultimate performance with it they’d be clocking it higher and giving it a much larger power budget.

We shall hopefully see this when they put out a pro machine they aren’t containing to 100 watts.
Well, the definition of ultimate performance really depends on what Apple's design goal is I suppose. I really don't think Apple cares too much about being top dog here. They probably have design goal targets and I suppose the current crop of AS Macs met most of their goals with a balance of performance to power/energy used.

Again, I like to point back to the benchmark posted here that shows the M1 Ultra scaling almost linearly compared to Xeons. The latest crop of 13th gen Intel (RL) or Zen 4 AMD CPUs likely cannot compare here. The unfortunate situation that we are seeing now is that the software are not optimised to take advantage of the M1 SoC architecture, which I think is balanced between I/O and processing capabilities. Changing software is hard and costly, so I think this situation will continue for quite a while.

Intel and AMD's approach smells a lot like desperation IMHO, energy usage be damed.
 
  • Like
  • Haha
Reactions: mi7chy and throAU

theorist9

macrumors 68040
May 28, 2015
3,880
3,060
Well, the definition of ultimate performance really depends on what Apple's design goal is I suppose. I really don't think Apple cares too much about being top dog here. They probably have design goal targets and I suppose the current crop of AS Macs met most of their goals with a balance of performance to power/energy used.
I know you're talking about desktops here but, interestingly, one can view Apple's efficiency goals as tantamount to a desire to be top dog in any device that's thermally constrained, which means mobile devices, including laptops, tablets and phones (which comprise most of what they sell). And that they've achieved (except for laptop GPU performance). For instance, the SC performance of the M2 is higher than that of any mobile CPU.
 
  • Like
Reactions: quarkysg

leman

macrumors Core
Oct 14, 2008
19,521
19,674
And? Those things are to help efficiency at lower power.

What do you mean “and”? And the result of it that M1 is 70% faster than i9 on perl regex code. Doesn’t this fact speak for itself?

Of course it’s not designed for “ultimate performance” (whatever that means). It’s still a damn fast CPU that can match or exceed the performance of much larger machines on common code patterns.
 

thinkinginventor

macrumors newbie
Oct 28, 2022
20
7
Your situation is unfortunate but from the way Apple, pundits, customers and end users have explained it Apple Silicon would not be able to squeeze every ounce of performance out of the hardware if Apple continued the old way of how everyone else is doing business.

And it shows with all the multitudes of benchmarks.

Upgrades introduces bottlenecks inherent to the physical distance between hardware to hardware. This impacts overall raw performance.

Best way to explain it would be like how a human city is built.

The most efficient cities are built to have all key infrastructure as close to the people as possible or even on site. So in terms of travel distance & time it is as short as possible.

Inefficient cities are designed to be sprawling with key infrastructure being only accessible via car on roads without alternatives of say a bus, or rail-based mass rapid system.

You can see this whenever looking at a logic board of a PPC vs Intel vs Apple Silicon.

I saw the logic board of a 2021 iMac 24" M1 and it is almost as tiny as that of an iPhone.

With the Mac Studio I think the target customer are those who never used the PCIe slots of the Mac Pro but want the raw performance. That's people like me.

Yes, I wish the memory & internal storage were user upgradable but I also wish they put in a Compact Flash card reader rather than a SD card reader. Why? Because I still use the highest-end Canon EF bodies marketed from 2009-2015. Yes, highest-end Canon RF bodies from 20220-onward use CFexpress B cards but I do not use em.

SD cards to me is a low-end annoyance but that's the most popular memory card for YouTubers and Sony users.

Yes, I wish the memory upgrades they offered were at most 2x the cost of 3rd party RAM or Apple standardised 2x the base memory & base storage of any Mac at the current price points.

So with your use case Mac Pro may be for you.

I have a 2002 Power Mac G4 and I never used the daughter board slots. I even wished I bought the highest-end 2022 iMac G4 20" but with the CPU & GPU of the Power Mac as that is what I wanted.

Mac Studio's a dream for me and merits its price point if only Apple's desktop SoCs had a higher power input rather than identical to all the laptops.

In other words why couldn't Apple overclock the M1 Max & M1 Ultra considering it is a desktop with an overpowered active heat sink fan so power draw isn't that much of a concern.

As for your 2018 purchase of the 2013 Mac Pro I am sympathetic to you but this forum's Buyers Guide and other resources would all point to that Mac Pro nearing its end of life. I believe as early as 2yrs prior to the 2019 model's release rumours were there for it.

Reminds me of myself when I bought the 2019 MacBook Pro 16" 14nm. There were rumours of a Apple Silicon Mac coming out weeks prior to my purchase. In my mind I was expecting a ~20% improvement so it would be cost effective for Apple and not worth the wait.

It did not dawn on me the impact of Apple using the same 5nm die shrink as the iPhone translating to >80% improvement on the Mac of everything and anything anyone could think of. Why? Because it has never been done that way before.

Apple, like all brands, will produce products people will want to buy. The Mac Pro you want will be available but because so few people want the old way of PC-style upgrade paths it will be at such a lower volume than a Mac Studio but at a price point anyone would cry over.

Businesses buying this will look at this at a total cost of ownership point of view rather than initial cost like what most consumers will be doing.
Thanks for the nice read, all good points! :)
 
  • Like
Reactions: sam_dean

Gudi

Suspended
May 3, 2013
4,590
3,267
Berlin, Berlin
It did not dawn on me the impact of Apple using the same 5nm die shrink as the iPhone translating to >80% improvement on the Mac of everything and anything anyone could think of. Why? Because it has never been done that way before.
I wasn't aware of Macs at the time, because all of Germany was almost exclusively PC territory. But people who lived through the last CPU transition remember it as an enormous speed increase. PowerPC development had somewhat stagnated, because of heat issues and Intel was about to introduce Core2Duo, its first 64-bit dual-core processors. No company would risk such a fundamental architecture transition unless there is potential for enormous improvements. Apple doing it for a third time was a hint that something big was coming.

 

sam_dean

Suspended
Sep 9, 2022
1,262
1,091
I wasn't aware of Macs at the time, because all of Germany was almost exclusively PC territory. But people who lived through the last CPU transition remember it as an enormous speed increase. PowerPC development had somewhat stagnated, because of heat issues and Intel was about to introduce Core2Duo, its first 64-bit dual-core processors. No company would risk such a fundamental architecture transition unless there is potential for enormous improvements. Apple doing it for a third time was a hint that something big was coming.


I've been using Macs for over 22 years. So I am somewhat familiar with the transition.

Below are all my computers, the die shrink of the chips used and the year the die shrink was introduced.

The last row with 5nm Mac is for comparison purposes.

QuarterYearDesktop/LaptopDie shrinkYear Die Shrink Release
1995Compaq Presario CDS 920800nm1987
1997IBM Thinkpad 380ED350nm1993
1999IBM Thinkpad 390E180nm1999
Summer2000iMac G3250nm1996
QS2002Power Mac G4180nm1999
Early2003iBook G3 12"130nm2001
Mid2005iBook G4 12"130nm2001
Early2006Macbook Pro 15"65nm2005
Mid2007iMac 20"65nm2005
Early2008Macbook Pro 15"45nm2007
Late2008Macbook Pro 15"45nm2007
Mid2010Macbook Pro 13"45nm2007
Late2011Macbook Pro 13"32nm2009
Mid2012MacBook Air 13"22nm2012
Late2012iMac 27"22nm2012
Early2015MacBook Air 11"14nm2014
Late2015iMac 21.5"14nm2014
Early2016MacBook 12"14nm2014
Early2017Dell Inspiron 7567 15"14nm2014
Late2018Macbook Air 13"14nm2014
Late2019Macbook Pro 16"14nm2014
Late2020Macbook Air 13"5nm2020

Imagine if I kept my 2010 Macbook Pro 13" that has 45nm process node introduced in 2007 then jumped to a 2020 5nm node? That's a 13 year leap in process node tech!

PowerPC chips use years old process nodes. I suspect this has to do with PowerPC not being able to buy priority manufacturing capacity

Larger nodes = more heat; more power consumption; less performance per watt; shorter battery life

Between 2006-2014 Intel's process nodes were a few months old before a shipping product appears.

2015-2020 Intel's process nodes stagnated at 14nm.

In 2020 Apple introduced an iPhone & Macs with Apple Silicon on a 5nm node.

Last Power Mac G5 was the Late 2005 model with a 90 nm process that was introduced in 2003.

1st Mac Pro was the mid 2006 model with a 65 nm process that was introduced in 2005.

The jump in die shrink process was by 1 shrink only for Power PC to Intel. It was an evolutionary change.

Compare that to Intel's 14nm to Apple Silicon's 5nm was a tech gap of 2014 to 2020 that skipped 10nm & 7nm.

This was very revolutionary.

Apple leveraged its priority in process nodes with TSMC to leapfrog Intel, AMD, Samsung and even Nvidia.

My expectation was that Apple would be 1 die shrink generation ahead of Intel for the purpose of keeping cost down. Not ahead of everyone.

This put into perspective how valuable the iPhone is to Apple.

The iPhone chip was the basis of the Mac chip. So say >95% of the R&D funding are taken from iPhone sales. Whatever Mac-specific improvements made are then funded by Mac sales.

Performance per watt, power consumption and raw performance gains for the iPhone is then applied to the Mac and other devices.

It saddens me that Apple did not make the design decision to overclock the desktop Mac chips beyond that of Mac laptops. If they did there would be a wider gap in performance between Intel & Mac at the same power input.

Power input is the amount of watts a computer, chips or parts can take.

I've taken note of the benchmark difference of the iPhone 8, 8 Plus & X vs 2017 MBP 13", Huawei P10, Xiaomi Mi 6, alaxy S8 and other phones since 2017.

Again I was surprised that the performance gap was that wide.

If I did then I would not have bought any laptop in 2017, 2018 & 2019.

Next year the 1st 3nm node process chips are expected to be released.

I expect the iPhone 15 Pro Max with USB-C (hopefully 40Gbps) will have 3nm node process Apple A17 Bionic chip. Will the M2 Pro/Max/Ultra/Extreme also be on 3nm process too?
 
Last edited:
  • Like
Reactions: vanc and Gudi

Gudi

Suspended
May 3, 2013
4,590
3,267
Berlin, Berlin
Imagine if I kept my 2010 Macbook Pro 13" that has 45nm process node introduced in 2007 then jumped to a 2020 5nm node? That's a 13 year leap in process node tech!
I don't need to imagine, I basically did just that with a bunch of iPhones and iPads in between. The 2010 13-inch MacBook Pro was the last one with a Core2Duo chip (45nm), while the 15 and 17-inch MacBook Pros of that year went for Core i5 and i7 (32nm). Steve Jobs defended that decision with 10h battery life and graphics performance. So regardless of the process node, you can either prioritize battery life or not.

Steve Jobs on 13-Inch MacBook Pro's Use of Intel Core 2 Duo Processors

 

sam_dean

Suspended
Sep 9, 2022
1,262
1,091
I don't need to imagine, I basically did just that with a bunch of iPhones and iPads in between. The 2010 13-inch MacBook Pro was the last one with a Core2Duo chip (45nm), while the 15 and 17-inch MacBook Pros of that year went for Core i5 and i7 (32nm). Steve Jobs defended that decision with 10h battery life and graphics performance. So regardless of the process node, you can either prioritize battery life or not.

Steve Jobs on 13-Inch MacBook Pro's Use of Intel Core 2 Duo Processors

10 hours battery?

Really?

I know it was 2-ish
 

sam_dean

Suspended
Sep 9, 2022
1,262
1,091
Now that my battery health is at 37%, it is 2 hours. And you know, with Intel chips that was basically idle website reading only, not any kind of actual computation.
Good thing I did not read that statement of Steve.

I'd have doubted my sanity... his reality distortion field is really that strong.

Again... imagine keeping the 2010 Macbook Pro 13" 45nm then jumping onto a 2020 Macbook Air 13" 5nm.

13 years jump of node process improvements.
 

leman

macrumors Core
Oct 14, 2008
19,521
19,674
Good thing I did not read that statement of Steve.

I'd have doubted my sanity... his reality distortion field is really that strong.

Independent reviewers were able to get 9 and half hours battery out of that model, so the claims were not at all outlandish. I had that particular laptop, it would do 6-7 hours on mixed workloads if memory serves me right, which was incredible at the time.
 

chars1ub0w

macrumors regular
Original poster
Jun 5, 2017
147
67
Here, there and over there
OP here. I am glad for the discussion but I am rather disappointed at some of the reactions. First, don't diss Perl regex. It is a fine and very powerful engine that has a lot of history. Nothing's perfect but Perl's strength in regex should be obvious to all - it's well copied, so we have PCRE and other languages have modules that emulate it. That's because regexs are used a lot. Second, the Perl regex test I used is a well-studied problem. I used it here because others can reproduce or dispute my results without installing any software. A one-liner illustrates a data point that I've seen time and time again. The M1 Max is not *significantly faster* in some cases. Third, I am a trained computer scientist. The log graph is commonly used when things get exponential so we can see differences at different levels. Fourth, I said in my original post - "Sometimes I'm not so impressed" with the M1 Max. Sometimes I am not so impressed with the Core i9. I will give an example in a fresh thread (as it will get lost here). Yes, I will use Perl regex again so it's easy for other to reproduce. And you can see a surprising difference (bad for the Core i9).
 

chars1ub0w

macrumors regular
Original poster
Jun 5, 2017
147
67
Here, there and over there
I am the OP in the recent MBP M1 Max vs. Core i9 thread in which I started off saying "Sometimes I'm not so impressed with my M1 Max MBP 16" (64GB RAM). Sometimes, it seems barely faster than the Core i9 15" (2018) MBP (32 GB RAM) that I also have."
Sometimes I am not so impressed with the Core i9. When I first got my Core i9, I bought two. One Dell and one MBP. Both with 32GB RAM, both with the same Core i9 laptop class processor. Here, we stick to M1 Max vs. Apple Core i9. (I have also just ordered a ThreadRipper PRO 5995WX system and will be testing that.) Rather than this getting buried in the other thread, I'll create a new one here. (Since I want the results to be easily reproducible or challenged, I will stick to Perl regex here, offering another easy-to-run example.)
The regex is a well-known short one /^(11+?)\1+$/, which can be used to determine whether a number (in unary notation) is prime.
Generally, the M1 Max is twice as fast in this case, except in the all-parallel case, the M1 Max is way faster because the x86 blows up (green line). The Core i9 has 6 cores plus Hyperthreading, which is generally worth delta (small improvement, I have lots of testing over the years on research code). The M1 Max has 8 performance cores + 2 efficiency cores. Not so different in my opinion. (The 5995WX has 64 cores and Hyperthreading. And the upcoming Mac Pro should have maybe 40+ cores, but we can't order that yet.)
Here is the serial code (to do the parallel version, just change $p to $p &):
#!/bin/bash
primes=(100003 200003 300007 400009 500009 600011 700001 800011 900001 1000003 1100009 1200007 1300021 1400017 1500007 1600033 1700021 1800017 1900009 2000003 2100001 2200013 2300003 2400001 2500009 2600011 2700023 2800001 2900017 3000017 3100007 3200003 3300001)
TIMEFORMAT='%3U'
for p in ${primes[@]}; do
time perl -le '$n = shift; $_ = "1" x $n; print "$n prime" if !/^(11+?)\1+$/' $p
done
wait

primes copy 2.png
 
  • Like
Reactions: Hippocrates

leman

macrumors Core
Oct 14, 2008
19,521
19,674
OP here. I am glad for the discussion but I am rather disappointed at some of the reactions. First, don't diss Perl regex. It is a fine and very powerful engine that has a lot of history. Nothing's perfect but Perl's strength in regex should be obvious to all - it's well copied, so we have PCRE and other languages have modules that emulate it. That's because regexs are used a lot.

Nobody is dissing Perl. I have also demonstrated that M1 runs real-work Perl reges significantly faster than i9.


Second, the Perl regex test I used is a well-studied problem. I used it here because others can reproduce or dispute my results without installing any software.

It’s might well-studied problem in the theory of non-deterministic automata and because it triggers a corner case in the reges engine as implemented by Perl. It’s probably not a good regex to use for benchmarking because no real world practically used regex is of that type.

A one-liner illustrates a data point that I've seen time and time again. The M1 Max is not *significantly faster* in some cases. Third, I am a trained computer scientist. The log graph is commonly used when things get exponential so we can see differences at different levels.

Actually, your graph does show that M1 is significantly faster. You just need to account for the fact that it’s a log graph. The i9 runtimes are substantially longer. Your graph focuses on the fact that algorithm scales like crap but precisely because you use a log scale it obfuscates the constant factor. If you are a trained computer scientist then you should understand that a faster CPU cannot magically change the complexity of the algorithm. For example, for n=30 M1 takes 100s and i9 takes what looks like 150 seconds or more - that’s difference of at least 50% more work done per unit of time! If that’s not significantly faster then I don’t know what is. And below n=15 your benchmark is dominated by Perl launch time, so it’s random OS-related noise.

Just a hint: plot the ratio between the runtimes and account for the startup time (check my post for a Perl script that inky benchmarks a relevant code section). Then you will see that M1 is actually faster even for your pathological regex.

Fourth, I said in my original post - "Sometimes I'm not so impressed" with the M1 Max. Sometimes I am not so impressed with the Core i9. I will give an example in a fresh thread (as it will get lost here). Yes, I will use Perl regex again so it's easy for other to reproduce. And you can see a surprising difference (bad for the Core i9).

This doesn’t change the fact that your post is misleading. When someone browsing the forums opens your thread they see a statement “m1 is not faster than i9” and a graph that seems to support it. But in reality your graph shows exactly the opposite to be true from what you are claiming.
 

leman

macrumors Core
Oct 14, 2008
19,521
19,674
Why Perl though? It's usually at the bottom for performance. Something like Go is more balanced as far as easy to learn and performance.

https://benchmarksgame-team.pages.debian.net/benchmarksgame/index.html

Because everyone has a Perl interpreter on their Unix machine and the language has been traditionally used for text processing. It’s also a small program with minimal C implementation and not much complexity, which makes it an interesting benchmarking case. I still wouldn’t recommend anyone to work with Perl. It’s unreadable and awkward.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.