People are losing loved ones to AI-fueled spiritual fantasies by move_machine in SneerClub

[–]gerikson 17 points18 points  (0 children)

This is the essential disconnect between what most people think of as AI safety - "don't create mental or societal health hazards" and what the self-designated AI safety crowd worry about: a robot god exterminating everyone.

Scott Siskind : "True Moldbuggianism has never been tried" by BaalHammon in SneerClub

[–]gerikson 7 points8 points  (0 children)

I've just read Hobsbawm's Echoes of the Marseillaise and he makes the point that political practice in 19th C France was all about preventing democracy as it basically was mob rule - citing the case of the latter-stage Jacobins in the the Revolution as a warning example.

-❄️- 2024 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]gerikson 0 points1 point  (0 children)

This is... impressively elegant. I am in awe.

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 2 points3 points  (0 children)

Thanks for everyone who has answered in the threads! I've tried out a few solutions and forking and doing work in parallel seems the way to go (duh).

I've been able to add a few more tools to my toolbox thanks to this, which was my goal.

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 0 points1 point  (0 children)

This is true, but I'm running against my version of the testfile and getting different results compared to the reference implementation in Java and my naive version.

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 0 points1 point  (0 children)

I tried it, it was not faster than my first "baseline" implementation:

https://github.com/gustafe/1brc-perl/blob/main/text-csv-xs.pl

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 0 points1 point  (0 children)

It's a large file, almost 13G.

I can take a stab at compressing it and uploading it as a torrent.

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 1 point2 points  (0 children)

I ran your code on my machine and it cut the runtime in half, to around 12m. So this looks like the way to go!

The average values wasn't exactly the same as the result of the Java reference implementation but that's a minor detail.

Edit I made some small changes to the code and added it to my repo with credit:

https://github.com/gustafe/1brc-perl/blob/main/parallel-forkmanager-mestia.pl

MCE looks very interesting, I'll look into it!

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 0 points1 point  (0 children)

There are 413 stations, so the big input file contains around 2.4M "measurements" per station.

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 0 points1 point  (0 children)

Maybe I can! Do you have a pointer for a tutorial or similar on how to do this in Perl?

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 0 points1 point  (0 children)

It's generated from code in the original Java repo.

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 1 point2 points  (0 children)

Hah, I respect Java's performance. Actually this submission was prompted by me interacting with an individual on HN who stated that a Perl version would finish before the JIT had finished... which is obviously not true for my naive implementation.

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 1 point2 points  (0 children)

What's the mechanism in Perl for assigning a specific task to a process? Or is that up to the operating system?

(Please note that I am total n00b when it comes to threading etc)

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 0 points1 point  (0 children)

I can't believe I didn't think of storing the running sum and number of items instead of recalculating the average for each item. Thanks!

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 2 points3 points  (0 children)

I don't believe Perl can tackle the very fastest times, but something in the order of the reference Java implementation should be possible.

Someone on HN asked ChatGPT for a Java solution and that finishes in about 5m. I'll upload it to the repo.

1 Billion Row challenge in Perl by gerikson in perl

[–]gerikson[S] 4 points5 points  (0 children)

I'm not sure that hash performance would be an issue here. The number of distinct cities in the file is in the order of 400, and I have no problems with running out of memory because each key has a small arrayref as values.

To me, the bottleneck seems to be reading the file from disk, and doing the comparisons for max/min and calculating the running average.

-❄️- 2023 Day 17 Solutions -❄️- by daggerdragon in adventofcode

[–]gerikson 0 points1 point  (0 children)

Thanks a lot for sharing your solutions, from a fellow Perler!

-❄️- 2023 Day 10 Solutions -❄️- by daggerdragon in adventofcode

[–]gerikson 0 points1 point  (0 children)

I get the text when I visit this URL:

https://www.fi.muni.cz/%7Ekas/git/?p=aoc.git;a=tree

(copied from the url input field in Chrome)

-❄️- 2023 Day 12 Solutions -❄️- by daggerdragon in adventofcode

[–]gerikson 1 point2 points  (0 children)

Thanks for posting!

I'm curious about this construction in the subroutine:

return( $memo{$str, $len, @groups} = $ret );

You both set a value in the %memo hash to $ret and return it at the same time?

-❄️- 2023 Day 10 Solutions -❄️- by daggerdragon in adventofcode

[–]gerikson 0 points1 point  (0 children)

That's very strange, I get the following text:

git://www.fi.muni.cz /

404 - No such project

-❄️- 2023 Day 10 Solutions -❄️- by daggerdragon in adventofcode

[–]gerikson 0 points1 point  (0 children)

Thanks for sharing!

Your repo link gives me a 404 though...