On Thu, Feb 17, 2022 at 01:44:07PM -0800, Bakul Shah wrote:
MacOS (m1 pro, prob. 2Ghz)
$ command time dc <<<
'2p3p[dl!d2+s!%0=@l!l^!<#]s#[s/0ds^]s@[p]s&[ddvs^3s!l#x0<&2+l.x]ds.x'
> xxx
time: command terminated abnormally
1.00 real 0.98 user 0.01 sys
[2] 37135 segmentation fault command time dc <<< > xxx
$ wc xxx
7342 7342 42626 xxx
$ size `which dc`
__TEXT __DATA __OBJC others dec hex
32768 16384 0 4295016448 4295065600 100018000
So macOS has got worse, or the systems have:
$ sysctl machdep.cpu.brand_string
machdep.cpu.brand_string: Intel(R) Core(TM)2 Duo CPU U9400 @ 1.40GHz
$ uname -a
Darwin Old-MBA.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 21 20:07:40 PDT 2018;
root:xnu-3248.73.11~1/RELEASE_X86_64 x86_64
Old-MBA:~ derek$ time dc <<<
'2p3p[dl!d2+s!%0=@l!l^!<#]s#[s/0ds^]s@[p]s&[ddvs^3s!l#x0<&2+l.x]ds.x'
> xxx
Segmentation fault: 11
real 0m14.982s
user 0m12.608s
sys 0m0.206s
$ wc xxx
7868 7868 45782 xxx
My old machine computed more primes before the program crashed!
Given the comment about the GNU s/w running out of stack, I guess the x86 version uses
smaller stack frames.
DF