From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Avoid malloc/free/dynwind for POSIX subrs that take strings Date: Tue, 05 May 2020 09:23:32 +0200 Message-ID: <87a72m26bv.fsf@igalia.com> References: <87h7x2qbxa.fsf@inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="101577"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: guile-devel@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Tue May 05 09:24:20 2020 Return-path: Envelope-to: guile-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 1jVrwC-000QGo-Lk for guile-devel@m.gmane-mx.org; Tue, 05 May 2020 09:24:20 +0200 Original-Received: from localhost ([::1]:59164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVrwB-0003uo-DL for guile-devel@m.gmane-mx.org; Tue, 05 May 2020 03:24:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVrw0-0003ub-SJ for guile-devel@gnu.org; Tue, 05 May 2020 03:24:08 -0400 Original-Received: from fanzine.igalia.com ([178.60.130.6]:55497) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jVrvz-0001zq-B9; Tue, 05 May 2020 03:24:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=9+6UWO9sVGcN4tND/M/hyXqhR30/D5GIR0DGRhPHe5Y=; b=g53iNGjBtV6a5yGdWjaP4EFnFdsdHA7SzMivg6p1xbQPDbnvJ6h4yBaMVBQY/n4XDpLOwEEQmCYndzqmkDxhKpzOZVqLV2PBNbYgoKrGTgGCr2J/XZCfeGxC/cBnGmNc5viLV8XL9d6ljaIx0FFjkqkAGCdNBLj8gVxhxqI5w1R6Q2+iSTYBtJ36yU0O9rcZmhfyhDfu6ErssMNCqKktmPlCquJbi106+AjC6xSpZ5WvDng4vgjwBj/Cvufz54owcFMdtSm+FSMRJE62jgDUIp+dBDYE7NtmwGrJNTTTN8igUrNLyQQMWzxe56iR0y/jjbHT92qhgVehO+VXLonqKg==; Original-Received: from 82-65-63-215.subs.proxad.net ([82.65.63.215] helo=milano) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1jVrvb-0006v5-16; Tue, 05 May 2020 09:23:43 +0200 In-Reply-To: <87h7x2qbxa.fsf@inria.fr> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22\?\= \=\?utf-8\?Q\?'s\?\= message of "Wed, 29 Apr 2020 22:22:57 +0200") Received-SPF: pass client-ip=178.60.130.6; envelope-from=wingo@igalia.com; helo=fanzine.igalia.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 03:23:43 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] 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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20512 Archived-At: Hi :) On Wed 29 Apr 2020 22:22, Ludovic Court=C3=A8s writes: > As discussed on IRC, the patch below arranges so that subrs that take > strings and pass them to syscall wrappers can avoid the > malloc/free/dynwind overhead. This gives a 10% speedup on a tight loop > that calls these subrs: Neat optimization. Since it's internal, no problem from me. My concern is only about calcifying aspects of our C / GC interface in API. > On IRC, Andy mentioned concerns that the SCM could disappear and thus, > our the internal pointer returned by =E2=80=98scm_locale_string_data=E2= =80=99 wouldn=E2=80=99t > be enough to prevent the stringbuf from being GC=E2=80=99d. I would suggest doing the whole optimization and being sure to do scm_remember_upto_here_1 on the SCM value at use sites. Andy