From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: immediate strings Date: Sat, 26 Nov 2011 13:13:22 -0800 Organization: UCLA Computer Science Department Message-ID: <4ED15672.9030600@cs.ucla.edu> References: <4ED04BBC.70803@yandex.ru> <4ED09DD4.1090201@cs.ucla.edu> <4ED0F7ED.8050700@yandex.ru> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1322342014 9154 80.91.229.12 (26 Nov 2011 21:13:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 26 Nov 2011 21:13:34 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Antipov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 26 22:13:30 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RUPYw-0000ft-GW for ged-emacs-devel@m.gmane.org; Sat, 26 Nov 2011 22:13:30 +0100 Original-Received: from localhost ([::1]:49953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RUPYv-0007Xw-2f for ged-emacs-devel@m.gmane.org; Sat, 26 Nov 2011 16:13:29 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:45234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RUPYr-0007Xg-Kw for emacs-devel@gnu.org; Sat, 26 Nov 2011 16:13:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RUPYq-0000w2-ES for emacs-devel@gnu.org; Sat, 26 Nov 2011 16:13:25 -0500 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:47945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RUPYq-0000vn-9G for emacs-devel@gnu.org; Sat, 26 Nov 2011 16:13:24 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 2387FA60001; Sat, 26 Nov 2011 13:13:22 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id solkc4lp+vpj; Sat, 26 Nov 2011 13:13:21 -0800 (PST) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id AE50739E8007; Sat, 26 Nov 2011 13:13:21 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 In-Reply-To: <4ED0F7ED.8050700@yandex.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146273 Archived-At: On 11/26/11 06:30, Dmitry Antipov wrote: > IIUC, string length can't be larger than most positive Lisp integer, > which is smaller than BITS_PER_EMACS_INT - 1 size bitfield anyway. Ah, sorry, I should have mentioned that I was thinking in the context of the patch for bug#9874, which improves performance on 32-bit platforms configured --with-wide int (so EMACS_INT is 64 bits, ptrdiff_t 32) by shrinking struct Lisp_String as follows: struct Lisp_String { - EMACS_INT size; - EMACS_INT size_byte; + ptrdiff_t size; + ptrdiff_t size_byte; INTERVAL intervals; /* text properties in this string */ unsigned char *data; }; In this environment we can still steal one bit from size and from size_byte without shrinking the maximum string length, but we'd need to use some other way to mark a string as multibyte, since size_byte would become an unsigned bitfield. I'm more optimistic than Eli and Stefan in thinking that something along the lines of a size+byte_size+intervals packing approach would yield a performance win that's worth the maintenance hassle. But of course all this will require a reasonable amount of hacking and measuring.