From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.devel Subject: Re: Shrinking the C core Date: Sun, 20 Aug 2023 15:01:25 +0200 Message-ID: References: <87zg2uqdmv.fsf@localhost> <87edk3gbh3.fsf@dataswamp.org> <87jztvnuyb.fsf@localhost> <875y5bdutt.fsf@dataswamp.org> <87y1i6e1uh.fsf@localhost> <874jkub40o.fsf@dataswamp.org> <87jztqdw2l.fsf@localhost> <871qfyb172.fsf@dataswamp.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="t3AjSTfhcR6VIRyt" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25439"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Aug 20 15:02:21 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qXi4S-0006KJ-6z for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Aug 2023 15:02:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qXi3i-0001bU-F6; Sun, 20 Aug 2023 09:01:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qXi3f-0001b8-LP for emacs-devel@gnu.org; Sun, 20 Aug 2023 09:01:31 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qXi3c-0007nq-Q7 for emacs-devel@gnu.org; Sun, 20 Aug 2023 09:01:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=n0zogStXVkdrz0bfZmDL/NDOYn/9/Wy9kG05p2MQjKA=; b=oz4WM5GXcAJv+iJrr+dBu00vrO reIxz3Gm1WpXGL8wwbss8EKXY38wPAUgDDRv7+5Ytd2wfeqNGYUF9W43b5fLNfQr9D7xvHKIP3r4S J+TvYjHaoQdFhZbjk3YO+XBXS60tOCXtDFRm8nvpqEJrCNFW3dkko17C+N2lplfCiEkmG8XSS5uW+ WSn/GnnN1HK4qC3wRnuLdRG9GxMFGuW05+NJFjlT4x0/IVnooyv5ZASwXOi6GxiU6kBvMOlnGImpv ITxxpTLcZBVcQtKK2nuF37Zx4EZNbfcbrM9+8x+K6U51DfRet5N6R+5EVpNyelmTydPM7OJjaYiv8 gtq/sK/A==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1qXi3Z-0006ug-J3 for emacs-devel@gnu.org; Sun, 20 Aug 2023 15:01:25 +0200 Content-Disposition: inline In-Reply-To: <871qfyb172.fsf@dataswamp.org> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308961 Archived-At: --t3AjSTfhcR6VIRyt Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 20, 2023 at 09:52:17AM +0200, Emanuel Berg wrote: > Ihor Radchenko wrote: >=20 > > If we talk about type checking, Elisp uses dynamic typing > > and compilation cannot do much about it. Native compilation > > also does not touch C subroutines - the place where > > typechecks are performed. >=20 > So our typechecks are not optimized, as we can native compile > Elisp but not C. >=20 > Worse, with dynamic typing they have to be used repeatedly and > during execution /o\ >=20 > Point taken - but we are compiling the C subroutines so in > theory optimization of typechecks could happen there [...] I humbly suggest you read up a bit on compilation. Those type checks happen at compile time for a reason: the very expensive data flow analysis provides the compiler with information which is quite difficult to obtain later. If you /know/ that some x will always be a nonnegative integer (because every path leading to your execution node either sets it to zero or increments it, for example), you can do away with that test and else branch: (if (> x 0) ... ...) but for that you have to take your program painstakingly apart into basic blocks, take note of what leads to where and think hard about which variables are munged where. That's why modern browsers come with more than one compiler: the price of that painstaking process is so high that you want to start quick and dirty (and slow) and focus on those things which really need attention. See [1] for a discussion in Guile's context. Cheers [1] https://wingolog.org/archives/2020/06/03/a-baseline-compiler-for-guile --=20 t --t3AjSTfhcR6VIRyt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZOIOngAKCRAFyCz1etHa RovsAJ4oJMWfhUF1oMHHXgezKEObx9BzGwCdFqOopWsafS4uaZL1qFCON2vyHko= =DYcq -----END PGP SIGNATURE----- --t3AjSTfhcR6VIRyt--