Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Real Users are afraid they'll break the machine -- but they're never afraid to break your face.


devel / comp.lang.awk / making 1.85 billion copies of "27" via gawk in 714 ms

SubjectAuthor
o making 1.85 billion copies of "27" via gawk in 714 msKpop 2GM

1
making 1.85 billion copies of "27" via gawk in 714 ms

<98a3a155-8b29-4459-84fb-f6098b15b598n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1254&group=comp.lang.awk#1254

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:6214:5296:b0:461:d3bb:ba01 with SMTP id kj22-20020a056214529600b00461d3bbba01mr38920507qvb.12.1653737736814;
Sat, 28 May 2022 04:35:36 -0700 (PDT)
X-Received: by 2002:a05:6902:110e:b0:644:daff:1e6f with SMTP id
o14-20020a056902110e00b00644daff1e6fmr46855809ybu.569.1653737736659; Sat, 28
May 2022 04:35:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Sat, 28 May 2022 04:35:36 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2603:7000:3c3d:41c0:0:0:0:3c3;
posting-account=n74spgoAAAAZZyBGGjbj9G0N4Q659lEi
NNTP-Posting-Host: 2603:7000:3c3d:41c0:0:0:0:3c3
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <98a3a155-8b29-4459-84fb-f6098b15b598n@googlegroups.com>
Subject: making 1.85 billion copies of "27" via gawk in 714 ms
From: jason.cy.kwan@gmail.com (Kpop 2GM)
Injection-Date: Sat, 28 May 2022 11:35:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Kpop 2GM - Sat, 28 May 2022 11:35 UTC

624
97968
7249632
14499264
28998528
57997056
115994112
231988224
463976448
927952896
1855905792

final length for [ "2727272727272727....2727272727272727" ] ::: 3711811584

# gawk profile, created Sat May 28 07:22:45 2022

# BEGIN rule(s)

BEGIN {
1 _ = (_ ^= __ = ____ = _ = 3) (_) (_) _
1 _ = (_ = (_) (_) _) _
1 ___ = "...."
1 --__
2 do {
2 gsub(___, "&" _, _)
2 print "", length(_)
} while (--__)
1 __ = (___) ___
1 (gsub("", (__) (__) (__) __, __)) + (gsub("....", _, __))
1 ____ *= ____
1 _ = ""
9 do {
9 print "", length(__)
9 __ = (__) __
} while (--____)
1 print sprintf("\n\n\t%.*sfinal length for [ \"%.*s....%s\" ] ::: %'.f\n\n", _ = _ < _, ___ = length(__), _ *= _ += _ += ++_, __, substr(__, -(--_ - ___)), ___)
}

( LC_ALL=C gawk -p- -be ; ) 0.20s user 0.46s system 92% cpu 0.714 total

~~~~~~~~~~~~~~~~~~~

Compared to gawk's interpreted scripting, even python3's built in replication feature isn't that much faster :

3711811584

( LC_ALL=C python3 -c 'print(len("27"*1855905792))'; )
0.11s user 0.25s system 98% cpu 0.373 total

~~~~~~~~~~~~~~~~~~~

And for those days you want 15.4 billion copies of "9" using gawk ::

168
7224
13053768
965978832
1931957664
3863915328
7727830656

final length for [ "9999999999999999....9999999999999999" ] ::: 15455661312

# gawk profile, created Sat May 28 07:33:29 2022

# BEGIN rule(s)

BEGIN {
1 _ = (_ *= __ = ____ = _ = 3) (_) (_) _
1 _ = (_ = (_) (_) _) _
1 ___ = "...."
1 __
3 do {
3 gsub(___, "&" _, _)
3 print _____, length(_)
} while (--__)
1 __ = (___) ___
1 (gsub(_____, (__) (__) (__) __, __)) + (gsub("....", _, __))
1 ____ += ! (_ = "")
4 do {
4 print _, length(__)
4 __ = (__) __
} while (--____)
1 print sprintf("\n\n\t%.*sfinal length for [ \"%.*s....%.*s\" ] ::: %'.f\n\n", _ = _ < _, ___ = length(__), _ *= _ += _ += ++_, __, _, substr(__, -(--_ - ___)), ___)
}

( LC_ALL=C gawk -p- -be ; ) 1.43s user 2.07s system 98% cpu 3.559 total

— The 4Chan Teller

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor