Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
yeah, jsc had a very nicely-tuned hashtable, and then v8 came out and just destroyed them with the structure optimization. object structures and structure-derivation trees (i don’t remember what they actually call this) were responsible for almost all of the v8 win iirc

Adbot
ADBOT LOVES YOU

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

we had shapes long before we had a JIT, because Spring or whatever had them and they worked well there, so why not? patched the bytecode and let us go straight to the right slots vector up the prototype tree without having to do the symbol lookups: more saved cache traffic! I think Brendan might have patented his variant? it’s a blur (but I do remember all the work to rein in pathological growth in the shape tree caused by hosed up JS on the web)

in v8 I think they’re called “hidden classes”? Ruby just got them last year

Soricidus
Oct 21, 2010
freedom-hating statist shill
2007 is when apple showed the world the future of computers, and told us to simply make web apps instead of writing platform-specific native code, and the world reacted with such horror that stebe himself was forced to back down.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
huh, i would’ve thought the shape optimization would’ve dominated. do you remember what jsc did better with object representations? was it like heap/gc stuff, or just the basic value representation?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

rjmccall posted:

huh, i would’ve thought that would’ve dominated. do you remember what jsc did better with object representations? was it like heap/gc stuff, or just the basic value representation?

a lot of it was just that their tree walker was a tiny amount of code and pipelined really well and our interpreter was a giant thing full of code optimized for 1990s compiler and processor behaviour. their strings were better in some way too—I think they couldn’t represent all the illegal-Unicode things that the standard specified, but it turned out that nobody really cared. we optimized our way to a bloated mess that never met an i$ it couldn’t thrash. I really had no idea about how significant those elements were 15-20 years ago, so it was quite the eye-opener

we were very jealous of v8 getting to design their representations knowing about how the modern web worked (and having a pet copy of that web to analyze and test against). they had done a bunch of things we hadn’t thought of, but a most of it was in our wishlist. we just couldn’t afford to redo the whole JSVM and how those representations were embedded all over the browser engine or twisted by old features that didn’t matter (E4X and LiveConnect and some poo poo that the Bloomberg terminal used, I’m looking at you)

we also cared a lot more about memory usage than the v8 team did, and they turned out to be on the right side of history there as well, since people notice fast all the time and only notice big when they open Activity Monitor

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

somewhat related is this excerpt from a friend’s short book about system optimization:



the punchline is that they were thrashing caches in ways that were slowing the rest of the system down, and with some detailed instrumentation of cache behaviour they were able to improve the whole system dramatically

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
macos updates stopped breaking valgrind a few years ago

(because they gave up on supporting macos)

Soricidus
Oct 21, 2010
freedom-hating statist shill

Subjunctive posted:

somewhat related is this excerpt from a friend’s short book about system optimization:



the punchline is that they were thrashing caches in ways that were slowing the rest of the system down, and with some detailed instrumentation of cache behaviour they were able to improve the whole system dramatically

what’s the book?

Athas
Aug 6, 2007

fuck that joker
I'm not going to yell about Valgrind on macOS, but I will stand outside Apple's house and yell about OpenMP forever.

Regarding dynamic linking, at this point I'm radicalized enough to say that recompiling the world should not be a problem. Make the code open. Use Nix. Whatever. These are solved problem except for proprietary and legacy code and eat the rich etc.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Soricidus posted:

what’s the book?

oops, meant to link it

https://carlos.bueno.org/optimization/

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!


nice, so far, this is worth it alone for distilling Jeff Dean's twelve or so Numbers Every Programmer Should Know down into four

Soricidus
Oct 21, 2010
freedom-hating statist shill

thank you, that was an excellent Friday afternoon read

minidracula
Dec 22, 2007

boo woo boo
new thread title:

Subjunctive posted:

never met an I$ I couldn’t thrash.

elsewhere, earlier:

Internet Janitor posted:

awk as an introductory programming language:

  • high performance
  • familiar, conventional c-like syntax
  • quality reference and tutorial materials are available
  • broadly used in professional environments
  • already installed on whatever posix os you're using
I knew I liked you both.

(I think the only bullet point IJ forgot (which, to be fair, isn't strictly necessary from a purely pedgogical standpoint, I suppose) is that awk is also pragmatically useful, and in more places than one might first expect or suspect.)

minidracula fucked around with this message at 00:21 on Mar 7, 2024

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

just don’t let me catch you piping grep into ask

minidracula
Dec 22, 2007

boo woo boo

Subjunctive posted:

just don’t let me catch you piping grep into ask

Only registered members can see post attachments!

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

timb has forsaken me

Voodoo Cafe
Jul 19, 2004
"You got, uhh, Holden Caulfield in there, man?"

minidracula posted:

new thread title:

elsewhere, earlier:



I knew I liked you both.

(I think the only bullet point IJ forgot (which, to be fair, isn't strictly necessary from a purely pedgogical standpoint, I suppose) is that awk is also pragmatically useful, and in more places than one might first expect or suspect.)

unfortunately awk is a gateway drug to perl, wherein lies true madness

i use both constantly

Voodoo Cafe
Jul 19, 2004
"You got, uhh, Holden Caulfield in there, man?"
realtalk though if awk didn't do wacky stuff like this it really would be almost a perfect introductory language though

minidracula
Dec 22, 2007

boo woo boo

Voodoo Cafe posted:

realtalk though if awk didn't do wacky stuff like this it really would be almost a perfect introductory language though
more like realtawk, amirite? :smuggo:

(Coincidentally, now that I think about it, I do use an AWK impl. called TAWK...)

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
yeah, awk's approach to scope and its extremely limited ability to work with records/collections are serious shortcomings for general purpose programming

significantly less hosed than bash, but not as much better as one might hope

still, it's the tool that is already in hand, and that counts for quite a bit

minidracula
Dec 22, 2007

boo woo boo
The thing I saw most recently re: awk that gave me any kind of pause was not really awk-specific as it was gawk-specific; right after installing WSL2 on a newly installed Windows laptop last night, of course one of the first things I do is check out what awk I have in the install/image:

code:
$ awk --version
GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)
It was around then that I yet again thought that the GNU Project Must Be Stopped.

Voodoo Cafe
Jul 19, 2004
"You got, uhh, Holden Caulfield in there, man?"

minidracula posted:

The thing I saw most recently re: awk that gave me any kind of pause was not really awk-specific as it was gawk-specific; right after installing WSL2 on a newly installed Windows laptop last night, of course one of the first things I do is check out what awk I have in the install/image:

code:
$ awk --version
GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)
It was around then that I yet again thought that the GNU Project Must Be Stopped.

i mean. isn't that to be expected? default wsl linux is ubuntu i think? it's not like you installed Windows Subsystem for FreeBSD

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
why does it need four versions. i mean i can sortof understand some pedant thinking it’s useful to have separate release and api versions even if it’s really pointless because there’s no good reason for the apis to not just roll forward in step with releases. but why have four versions

pseudorandom name
May 6, 2007

Four versions? Get with the times, gramps.

GNU Awk 5.2.2, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0-p12, GNU MP 6.2.1)

Visions of Valerie
Jun 18, 2023

Come this autumn, we'll be miles away...

minidracula posted:

the GNU Project Must Be Stopped.

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

pseudorandom name posted:

GNU Awk 5.2.2, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0-p12, GNU MP 6.2.1)

Mozilla/5.0 (iPhone14,3; U; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/19A346 Safari/602.1

minidracula
Dec 22, 2007

boo woo boo

Voodoo Cafe posted:

i mean. isn't that to be expected? default wsl linux is ubuntu i think? it's not like you installed Windows Subsystem for FreeBSD
I'm reacting more to awk being built with GMP and MPFR than anything else. And I'm mostly just poking fun in a light-hearted way.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
okay so i looked it up and i really do not understand why i would want to know what version of arbitrary-precision math library awk is using. also i wasn’t aware awk had that kind of math processing at all

minidracula
Dec 22, 2007

boo woo boo

rjmccall posted:

okay so i looked it up and i really do not understand why i would want to know what version of arbitrary-precision math library awk is using. also i wasn’t aware awk had that kind of math processing at all
...and one might also argue that maybe it shouldn't, that maybe there's such a thing as going too far.

That said, I get that some gawk extensions are nice and/or useful, though I tend to avoid them myself, or just specifically distinguish between generic "awk" programs versus specifically gawk-only programs. And those usually also depend on a specific gawk version, since the extensions vary a lot by version (or can anyway). But then again: I really only write the latter both 1) rarely and 2) almost exclusively to futz with some specific gawk extension for its own sake, so again, maybe gawk has taken this a bit too far...

Like honestly, I didn't even know until last night when I saw this version banner that gawk now had arbitrary precision math support, and my first reaction was something like "whuh?" followed quickly by "but why?"

minidracula fucked around with this message at 06:29 on Mar 7, 2024

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

minidracula posted:

Like honestly, I didn't even know until last night when I saw this version banner that gawk now had arbitrary precision math support, and my first reaction was something like "whuh?" followed quickly by "but why?"

obviously they couldn’t agree on a precision to use, so…

pseudorandom name
May 6, 2007

rjmccall posted:

okay so i looked it up and i really do not understand why i would want to know what version of arbitrary-precision math library awk is using. also i wasn’t aware awk had that kind of math processing at all

its so you can include the version string in bug reports op

Soricidus
Oct 21, 2010
freedom-hating statist shill
I don’t really understand the need to learn advanced awk stuff when perl is right there out of the box too on most unices (and way more portable), but I respect people who do it anyway

nightmare fuel: imagine if there was a gnu perl

BobHoward
Feb 13, 2012

The only thing white people deserve is a bullet to their empty skull

Soricidus posted:

nightmare fuel: imagine if there was a gnu perl

shudder. iirc one of the many perl5 issues is that it's a plang with no formal specification, just the lone reference implementation. i can only imagine how many hilarious incompatibilities would occur in a different try, regardless of whether it was a gnu project

Cybernetic Vermin
Apr 18, 2005

rjmccall posted:

okay so i looked it up and i really do not understand why i would want to know what version of arbitrary-precision math library awk is using. also i wasn’t aware awk had that kind of math processing at all

there used to be a lot of rather buggy versions of gmp floating around. and of course the option of awk 4.3.1 being built (and ideally shipped) with the specific version of gmp that the devs used and qa'd against would interfere with the random-dynamic-linking-linux-packaging carousel of madness.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

BobHoward posted:

shudder. iirc one of the many perl5 issues is that it's a plang with no formal specification, just the lone reference implementation. i can only imagine how many hilarious incompatibilities would occur in a different try, regardless of whether it was a gnu project

yeah, when we were adding regular expressions to JS we wanted to match Perl’s semantics but we kept running into weird cases that didn’t make sense when tested in Perl itself. perl5-porters@ or whatever the mailing list was would just respond “oh well, that’s how it works so it’s by definition correct” and shrug. made the standardization process a lot of fun!

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Soricidus posted:

I don’t really understand the need to learn advanced awk stuff when perl is right there out of the box too on most unices (and way more portable), but I respect people who do it anyway

some of us built those brain-patterns before perl was available everywhere out of the box, have a little compassion

Xarn
Jun 26, 2015
perl is not a serious language

Voodoo Cafe
Jul 19, 2004
"You got, uhh, Holden Caulfield in there, man?"

Xarn posted:

perl is not a serious language

i'd say it's serious in the same way that a rash or foot fungus can be

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen

Soricidus posted:

nightmare fuel: imagine if there was a gnu perl

MS Visual Perl for Applications

Adbot
ADBOT LOVES YOU

MononcQc
May 29, 2007

Awk's variables are hosed up, but the workaround for them is hilarious: if you declare a variable as a function parameter, it won't share a scope with the parent callers; also if you declare a variable as a function parameter and it is not put in by the caller, it's gonna be uninitialized. Therefore, declare your local-scoped variables as function parameters. Here's a snippet from some code I wrote when doing the 2021 advent of code with Awk (up until day 14):

code:
func common(k,arr,    i,c) {
    for (i in arr) { c += arr[i][k]*2-1 }
    return c>=0
}

func cull(k,v,arr,    i) {
    for (i in arr) { if (arr[i][k] != v) { delete arr[i] } }
}

func to_n(arr,    i,j,c) {
    for (i in arr) { for (j in arr[i]) { c=lshift(c,1)+arr[i][j] } }
    return c
}
So these "conventions" you can use of putting a bunch of whitespace between params and local values lets you be a bit more explicit about what is a globally scoped and what is a locally scoped variable.

also I will always mention my tutorial to learn awk in 20 minutes: https://ferd.ca/awk-in-20-minutes.html

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply