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: inline build_string performance Date: Tue, 26 Jun 2012 07:53:51 -0700 Organization: UCLA Computer Science Department Message-ID: <4FE9CCFF.2060309@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1340722452 12929 80.91.229.3 (26 Jun 2012 14:54:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 26 Jun 2012 14:54:12 +0000 (UTC) Cc: Emacs Development To: Dmitry Antipov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 26 16:54:11 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SjX9d-0007og-IT for ged-emacs-devel@m.gmane.org; Tue, 26 Jun 2012 16:54:09 +0200 Original-Received: from localhost ([::1]:52765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjX9d-0002VG-KM for ged-emacs-devel@m.gmane.org; Tue, 26 Jun 2012 10:54:09 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjX9T-0002Um-Ps for Emacs-devel@gnu.org; Tue, 26 Jun 2012 10:54:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SjX9O-0001ff-Fq for Emacs-devel@gnu.org; Tue, 26 Jun 2012 10:53:59 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:46007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjX9O-0001er-9b for Emacs-devel@gnu.org; Tue, 26 Jun 2012 10:53:54 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 1F38C39E80E0; Tue, 26 Jun 2012 07:53:52 -0700 (PDT) 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 9W+4h04YFOiU; Tue, 26 Jun 2012 07:53:51 -0700 (PDT) Original-Received: from [192.168.1.10] (pool-108-23-119-2.lsanca.fios.verizon.net [108.23.119.2]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 68DFE39E800E; Tue, 26 Jun 2012 07:53:51 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 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:151184 Archived-At: Trunk bzr 108742 changed build_string from a standard extern function to a static inline function: static inline Lisp_Object build_string (const char *str) { return make_string (str, strlen (str)); } This is not an unalloyed win, since it bloats the size of the Emacs executable, as callers to build_string often now have two function calls (strlen + make_string), not one (just build_string). In my environment (Fedora 15 x86-64, GCC 4.7.1) this patch adds 5704 bytes (0.25%) to the size of the Emacs text. Presumably this puts a bit more pressure on the text cache. Has a performance analysis been done on this change showing that the code bloat is worth it? While we're on the subject, I suspect that we'll get more of a performance win by having a function 'build_unibyte_string' in the common case where build_string is invoked on text that is known to be unibyte, as that avoids a separate pass through the string. I haven't had time to investigate this, though.