From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add a mechanism for passing unibyte strings from lisp to modules. Date: Thu, 27 Jun 2024 09:05:06 +0300 Message-ID: <86ed8i7wfh.fsf@gnu.org> References: <225D336D-933E-4CA3-B245-89992D7E6C41@umanwizard.com> <86frt5jwtc.fsf@gnu.org> <87o77t6lyn.fsf@taipei.mail-host-address-is-not-set> <867cehgdn1.fsf@gnu.org> <861q4md0o1.fsf@gnu.org> <87jzickjq8.fsf@taipei.mail-host-address-is-not-set> <86wmmb99f7.fsf@gnu.org> <86ikxv96sd.fsf@gnu.org> <867ceb90qj.fsf@gnu.org> <87wmmbgiq7.fsf@taipei.mail-host-address-is-not-set> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33168"; mail-complaints-to="usenet@ciao.gmane.io" Cc: tomas@tuxteam.de, acorallo@gnu.org, stefankangas@gmail.com, emacs-devel@gnu.org To: "Brennan Vincent" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 27 08:06:12 2024 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 1sMiGp-0008PZ-95 for ged-emacs-devel@m.gmane-mx.org; Thu, 27 Jun 2024 08:06:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMiFv-0002Wo-Ut; Thu, 27 Jun 2024 02:05:15 -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 1sMiFt-0002SJ-MZ for emacs-devel@gnu.org; Thu, 27 Jun 2024 02:05:13 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMiFq-0002Q2-7q; Thu, 27 Jun 2024 02:05:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ECU7kLyPY2LYxzBGe5b39Gs6G1Wmy96/aVUCXMvuylA=; b=adrNTTZdyZS5 8ezIPFFro2OSCfPr7PR/e0WfZoMApV0a1Ekdz87eirEuQ+F1OWkftCDC2p+OEVYX5acrs9FYTtewU gYd3WeCqL3drrWBYZEk0SQC3hIvkZpj970CWwlFRrxg6CYhzXUPxsmvf5ZjevEJRaOscv+Ycu7gpb dAdEv3/DPsGF8JROHoGMQ4yKE91tEenFDSm1Wnv9OEqTcVkUdh9bOuUI+4TaBwA7+Hkz8j3gl6Afw 1XHOAQjAupNydQ98VMdEuYgkEnE4hpJnS0iqhbvmJjZvuP4U5pkMJggHjzZYje7Uv5xwDXbMaS+X3 oBMw76thiBdnw0VIhe50bw==; In-Reply-To: <87wmmbgiq7.fsf@taipei.mail-host-address-is-not-set> (brennan@umanwizard.com) 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:320745 Archived-At: > From: "Brennan Vincent" > Cc: acorallo@gnu.org, stefankangas@gmail.com, emacs-devel@gnu.org > Date: Wed, 26 Jun 2024 23:36:16 -0400 > > Eli Zaretskii writes: > > >> Having a specialized "array of bytes" (as there is one for bools) > >> might be beneficial for big arrays, and perhaps avoid big data moving > >> operations over the C/LISP fence. > > > > If you are saying that using 64-bit values there incurs a run-time > > performance penalty, then accessing bytes does that as well. Someone > > should profile this and present evidence wrt the relative performance > > of these, then we can discuss whether the penalty is real and whether > > it is worth adding yet another data type to Emacs. > > Sure, I wrote a quick benchmark that passes a 10MB buffer to a module > which just sums the bytes and returns and integer. It is about 200x > faster using a unibyte string (with my original patch) than a vector. That's not an interesting benchmark: you are doing everything in C. Emacs modules are intended to allow doing stuff in Lisp, not in C. Writing a program that compares memcpy against a loop that extracts values from an array and then calls a function to assign those values, is a strawman, IMO. In addition, the measurements I was talking about were not to compare strings vs vectors, they were to compare the vectors we already have in Emacs Lisp with the proposed "vectors of bytes". That was Tomas's proposal. Your benchmark doesn't make that comparison.