From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: immediate strings #2 Date: Mon, 28 Nov 2011 12:33:26 -0500 Message-ID: References: <4ED35057.8010103@yandex.ru> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1322501627 7302 80.91.229.12 (28 Nov 2011 17:33:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 28 Nov 2011 17:33:47 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Antipov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 28 18:33:42 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 1RV55G-0004HC-O3 for ged-emacs-devel@m.gmane.org; Mon, 28 Nov 2011 18:33:38 +0100 Original-Received: from localhost ([::1]:57576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RV55F-0000Hy-VZ for ged-emacs-devel@m.gmane.org; Mon, 28 Nov 2011 12:33:37 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:51669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RV559-0000Hg-7h for emacs-devel@gnu.org; Mon, 28 Nov 2011 12:33:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RV556-0000p7-3f for emacs-devel@gnu.org; Mon, 28 Nov 2011 12:33:31 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:40497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RV555-0000ox-Vv for emacs-devel@gnu.org; Mon, 28 Nov 2011 12:33:28 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id pASHXQtO017816; Mon, 28 Nov 2011 12:33:26 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 3A79F58D75; Mon, 28 Nov 2011 12:33:26 -0500 (EST) In-Reply-To: <4ED35057.8010103@yandex.ru> (Dmitry Antipov's message of "Mon, 28 Nov 2011 13:11:51 +0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4055=0 X-NAI-Spam-Version: 2.2.0.9286 : core <4055> : streams <705998> : uri <1017661> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 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:146311 Archived-At: > struct Lisp_String > { > + /* Text properties in this string. */ > + INTERVAL intervals; > + > + /* Mark bit used for GC. */ > + unsigned gcmarkbit : 1; > + > + /* String subtype. */ > + unsigned immbit : 1; > + > + union { > + > + /* When IMMBIT is 1. */ > + struct { > + EMACS_INT size : 7; > + EMACS_INT size_byte : 7; > + unsigned char data[STRING_IMM_MAX]; > + } imm; > + > + /* When IMMBIT is 0. */ > + struct { > + EMACS_INT size : BITS_PER_EMACS_INT - 1; > + EMACS_INT size_byte : BITS_PER_EMACS_INT - 1; > + unsigned char *data; > + } dat; > + } u; > }; I don't know any C compiler able to allocate unions at the bit level, so the above struct will have the following layout: INTERVAL: 32 gcmarkbit: 1 immbit: 1 : 30 union: 96 I'm not sure about the layout of dat.size_byte, but I could even imagine it straddling two words. You need to move the immbit and gcmarkbit into the union :-( It's great to see that it can speed up compilation, tho (although the 1.3% difference could just as well be due to noise). You might want to check what proportion of those strings have a NULL `intervals' field. Stefan