all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Attila Lendvai <attila@lendvai.name>
To: Evan Cooney <evancooney71@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: Including code in a non-Guile language into Guix
Date: Fri, 01 Nov 2024 22:49:49 +0000	[thread overview]
Message-ID: <ssk7kNM1OxzSptmbohlnpy4ixiNkJymQYwefmivtwjGQUSqim5453JyfE3LBksvmCvHiXfjr8e9SuO1CIwGFTYu1aKPCVGbooJymFz800V0=@lendvai.name> (raw)
In-Reply-To: <CA+NEbmQkSNLq+3_mzYwrK864mCsaaz6U9n4DpGrHT4KUK6wwuw@mail.gmail.com>

> I know that Guix is mainly written in Guile, but has much thought
> gone into optimizing these commands by rewriting some of the code in
> a more performance-oriented language like C?


this is a slow-dying, but completely unjustified stereotype of C and "highlevel" languages like lisp.

the truth is that for any non-trivial problem/domain it's easier to write faster lisp code than C.

the reason is that even if a FOR loop runs twice as fast in C (it's not), if the programmer can spend more time thinking/experimenting with the domain, and come up with a better optimization *in the domain*, then he may gain *orders of magnitude*, not a mere doubling that "more performance-oriented languages" provide.

and if the task is about the most efficient use of the hardware at hand (think of simulations), then i have way more tools to profile my lisp code, and it's way easier to extend the lisp compiler under me with some custom-made primitives to peephole optimize my hotspots. or run the same code with and without custom made instrumentation to gain more insights about the bottlenecks. or compile my hotspots at runtime, if e.g. i have a task that rarely changes, but must be repeated endlessly (think of a firewall). or if the domain is such, then straight out write a custom compiler for a DSL that is specific to the task at hand, and seamlessly integrates into the the rest of my lisp codebase.

when coding in C you're wasting a lot of your attention on manually translating the domain to a verbose mess of C code that can't really encode much of the domain abstractions. writing C code is much more of a manual, lossy translation from domain-to-C than writing a lisp solution to the same problem, which is much more about converging lisp and your domain from both directions. and on top of this all, what a timesink debugging C code can be!

</rant>

PS: note though that the above is written from experience with more capable lisps like SBCL + Slime.

-- 
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“Government is the great fiction through which everybody endeavors to live at the expense of everybody else.”
	— Frédéric Bastiat (1801–1850), 'The State' (1848)



      parent reply	other threads:[~2024-11-01 22:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31  2:34 Including code in a non-Guile language into Guix Evan Cooney
2024-10-31 12:31 ` Daniel Littlewood
2024-10-31 14:15   ` Suhail Singh
2024-10-31 16:13     ` Ricardo Wurmus
2024-10-31 17:12       ` Suhail Singh
2024-10-31 16:15     ` Runciter via Development of GNU Guix and the GNU System distribution.
2024-10-31 16:23       ` Evan Cooney
2024-10-31 16:15 ` Ricardo Wurmus
2024-11-01 22:49 ` Attila Lendvai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ssk7kNM1OxzSptmbohlnpy4ixiNkJymQYwefmivtwjGQUSqim5453JyfE3LBksvmCvHiXfjr8e9SuO1CIwGFTYu1aKPCVGbooJymFz800V0=@lendvai.name' \
    --to=attila@lendvai.name \
    --cc=evancooney71@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.