Post 9sULe40LiLyVB3LOmO by drisc@merveilles.town
 (DIR) More posts by drisc@merveilles.town
 (DIR) Post #9sULe40LiLyVB3LOmO by drisc@merveilles.town
       2020-02-27T21:36:41Z
       
       0 likes, 1 repeats
       
       C is the past, C is the future."Thompson and his colleagues showed that they could get a computationally intensive calculation to run some 47 times faster just by switching from Python, a popular general-purpose programming language, to the more efficient C. [...] Further tailoring the code to take full advantage of a chip with 18 processing cores sped things up even more. In just 0.41 seconds, the researchers got a result that took seven hours with Python code."https://www.technologyreview.com/s/615226/were-not-prepared-for-the-end-of-moores-law/
       
 (DIR) Post #9sVHlfrHAVLdwlQwfA by wizzwizz4@fosstodon.org
       2020-02-28T17:41:05Z
       
       0 likes, 0 repeats
       
       @drisc And yet, C is also holding us back. The structure of modern processors is designed to provide a virtual machine for the C runtime, when that doesn't actually match what's happening on the processor.C is not a low-level language. Now assembly is not a low-level language.
       
 (DIR) Post #9sVI2NPR0yePeQNL6G by tuxcrafting@letsalllovela.in
       2020-02-28T17:44:06.580872Z
       
       0 likes, 0 repeats
       
       @drisc C is terrible. just terrible. there is no word to describe C other than "terrible"the syntax is idiotic, the type system is non-existent, and every feature seems carefully designed to allow you to shoot yourself in the foot with maximum efficiency
       
 (DIR) Post #9sVIK1QfTVfmh3MluK by lucy@fedi.absturztau.be
       2020-02-28T17:47:19.041302Z
       
       0 likes, 0 repeats
       
       @tuxcrafting @drisc > type system non-existent>  every feature seems carefully designed to allow you to shoot yourself in the foot with maximum efficiencythat's what makes C so useful imo
       
 (DIR) Post #9sVIVyC5KTIU8PF5YO by tuxcrafting@letsalllovela.in
       2020-02-28T17:49:27.320987Z
       
       0 likes, 0 repeats
       
       @lucy @drisc and also makes it so fucking painful to use for any sizeable project
       
 (DIR) Post #9sVIcH8Np3f4c9W9ZI by lucy@fedi.absturztau.be
       2020-02-28T17:50:36.984995Z
       
       1 likes, 0 repeats
       
       @tuxcrafting @drisc how about you're just to stupid to code?
       
 (DIR) Post #9sVIfoNWg4tsaXHq4m by tuxcrafting@letsalllovela.in
       2020-02-28T17:51:14.462017Z
       
       2 likes, 0 repeats
       
       @lucy @drisc ok sure go try doing any sort of event-based async programming in Chint: prepare alcohol
       
 (DIR) Post #9sVIlkVjyC88KZxayG by absturztaube@fedi.absturztau.be
       2020-02-28T17:52:19.173969Z
       
       1 likes, 0 repeats
       
       @tuxcraftinghint: prepare a lot of alcohol@lucy @drisc
       
 (DIR) Post #9sVInmqgFVkOA0j66S by lucy@fedi.absturztau.be
       2020-02-28T17:52:41.663984Z
       
       0 likes, 0 repeats
       
       @tuxcrafting @drisc hint: alcohol is my cofeok sure try to leave school and take a look at the real world, there's no "choose what's best", only "choose what's less pain in the ass from what's given"
       
 (DIR) Post #9sVIojYzwteyGFuJEW by lucy@fedi.absturztau.be
       2020-02-28T17:52:51.949718Z
       
       1 likes, 0 repeats
       
       @absturztaube @tuxcrafting @drisc :absinthe:
       
 (DIR) Post #9sVIs2a9h7OQ7D1czw by absturztaube@fedi.absturztau.be
       2020-02-28T17:53:27.383204Z
       
       0 likes, 0 repeats
       
       @lucywhy do so many ppl use perl then?@tuxcrafting @drisc
       
 (DIR) Post #9sVIxmyEeQBRQz1sxM by lucy@fedi.absturztau.be
       2020-02-28T17:54:30.179641Z
       
       0 likes, 0 repeats
       
       @absturztaube @drisc @tuxcrafting convenience I guess
       
 (DIR) Post #9sVJ8Zckc5VRE57fqi by absturztaube@fedi.absturztau.be
       2020-02-28T17:56:26.146662Z
       
       1 likes, 0 repeats
       
       @lucyconvenience? with perl?:blobcatlul: @drisc @tuxcrafting
       
 (DIR) Post #9sXBTeRDV2EKv8Bfou by alvarezp@mastodon.xyz
       2020-02-29T15:40:00Z
       
       0 likes, 0 repeats
       
       @wizzwizz4 @drisc If I want to efficiently use the processor by using a language that does match the CPU architecture, what language should I use?
       
 (DIR) Post #9sXCoPpP77KPdzxwNk by wizzwizz4@fosstodon.org
       2020-02-29T15:54:59Z
       
       0 likes, 0 repeats
       
       @alvarezp @drisc There are some C extensions that permit explicit parallelisation, but apart from microcode I don't know of any.Your best bet is probably to pick an optimising C compiler, then learn the incantations to invoke vectorisation, etc.. Or just use Lisp, and be as kind to the compiler as possible (types, etc.).Or, use Rust. Its optimisation abilities aren't great yet, but it's only slightly worse than C (clang) and will (hopefully) beat it soon. https://old.reddit.com/r/rust/comments/5urar1/is_rust_likely_the_next_fastest_language_after_c/
       
 (DIR) Post #9sXDJotdxaaoMxvJnk by alvarezp@mastodon.xyz
       2020-02-29T16:00:38Z
       
       0 likes, 0 repeats
       
       @wizzwizz4 @drisc I would like to try them. Are those low-level?
       
 (DIR) Post #9sXDsGDesgBMxIhwuW by wizzwizz4@fosstodon.org
       2020-02-29T16:06:53Z
       
       0 likes, 0 repeats
       
       @alvarezp @drisc What's "them"?OpenMP <https://en.wikipedia.org/wiki/OpenMP> is the example I was thinking of. It permits parallelisation. You'll need to keep in mind the vectorisation incantations I mentioned if you want this to be reasonably fast. But it's still not actually using the processor's resources efficiently, because the processor is actively emulating a virtual x86 machine that you can never turn off.Lisp is amazing. Learn it, even if you never use it for anything.1/2
       
 (DIR) Post #9sXEtqjsgeE0Sm6LQG by wizzwizz4@fosstodon.org
       2020-02-29T16:18:22Z
       
       0 likes, 0 repeats
       
       @alvarezp @driscYou already know what C is, so I'll skip it and talk about Rust.Rust is not low-level, but the manner it relates to low-level constructs is easy to understand.Really, Rust is actually two languages: Safe Rust and Unsafe Rust. Unsafe Rust gives you the power of C, and you can even go as far as issuing individual processor instructions <https://doc.rust-lang.org/core/arch/index.html> without needing to manage registers yourself! Safe Rust, however, will always Just Work, and will never break.2/2
       
 (DIR) Post #9sXFVHlDBVO2z1ZgES by alvarezp@mastodon.xyz
       2020-02-29T16:25:08Z
       
       0 likes, 0 repeats
       
       @wizzwizz4 @drisc "Them" = lisp and rust, the languages you described, but now you mentioned OpenMP, which adds to the list of things to learn.