• 0 Posts
  • 28 Comments
Joined 1 year ago
cake
Cake day: June 10th, 2023

help-circle











  • Gamma@programming.devtoProgrammer Humor@lemmy.mlNew File Format
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    1 year ago

    Thought I’d check on the Linux source tree tar. zstd -19 vs lzma -9:

    ❯ ls -lh
    total 1,6G
    -rw-r--r-- 1 pmo pmo 1,4G Sep 13 22:16 linux-6.6-rc1.tar
    -rw-r--r-- 1 pmo pmo 128M Sep 13 22:16 linux-6.6-rc1.tar.lzma
    -rw-r--r-- 1 pmo pmo 138M Sep 13 22:16 linux-6.6-rc1.tar.zst
    

    About +8% compared to lzma. Decompression time though:

    zstd -d -k -T0 *.zst  0,68s user 0,46s system 162% cpu 0,700 total
    lzma -d -k -T0 *.lzma  4,75s user 0,51s system 99% cpu 5,274 total
    

    Yeah, I’m going with zstd all the way.






  • It’s interesting, the results here are way different than the Code Golf & Coding Challenges Stack Exchange. I would never expect Haskell to be that low. But after looking at code.golf, I realize it’s because I/O on CG&CC is more relaxed. Most Haskell submissions are functions which return the solution.

    Sidenote: I like the CG&CC method, it’s semi-competitive, semi-cooperative.

    • all languages welcome
    • almost all users post “Try it Online”/“Attempt This Online” links
    • most users post explanations under their submissions
    • often people will post solutions beginning with “port of user1234’s excellent Foolang answer” when there’s a clever shortcut someone finds
    • or people will post their own solution with “here’s a solution which doesn’t use user1234’s algorithm
    • or people will add comments to answers with minor improvements

    IMO It’s geared towards what is the best part about code golf: teaching people about algorithm design and language design.


  • This has never stuck with me, and I hadn’t thought about why until now. I have two reasons why I will always write ${x}_$y.z instead of ${x}_${y}.z:

    • Syntax highlighting and shellcheck have always caught the cases I need to add braces to prevent $x_ being expanded as ${x_}.
    • I write a lot of Zsh. In Zsh, braces are optional in way more cases. "$#array[3]" actually prints the length of the third item in array, rather than (Bash:) the number of positional parameters, then the string 'array[3]'.