From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.lisp.gcl.devel Subject: Re: utf8 and emacs text/string multibyte representation Date: Wed, 29 Oct 2014 12:45:58 -0400 Message-ID: References: <87wq7jxc7d.fsf@gnu.org> <87zjcfx985.fsf_-_@maguirefamily.org> <83mw8f0w08.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1414601196 19555 80.91.229.3 (29 Oct 2014 16:46:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Oct 2014 16:46:36 +0000 (UTC) Cc: Camm Maguire , gcl-devel@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 29 17:46:29 2014 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 1XjWO9-0003LC-T9 for ged-emacs-devel@m.gmane.org; Wed, 29 Oct 2014 17:46:26 +0100 Original-Received: from localhost ([::1]:47421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjWO9-0007AC-Jh for ged-emacs-devel@m.gmane.org; Wed, 29 Oct 2014 12:46:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjWO0-00079G-DE for emacs-devel@gnu.org; Wed, 29 Oct 2014 12:46:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjWNs-0002V4-MG for emacs-devel@gnu.org; Wed, 29 Oct 2014 12:46:16 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:22058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjWNk-0002Sh-LC; Wed, 29 Oct 2014 12:46:00 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Au0MAOatTlRFpY87/2dsb2JhbABcgw6DYoZ+y1MEAgKBHBcBAXyEAwEBAwFWIxALNBIUGA0kiEsJy3IBAQEBBgIBH5EIB4RLBbIggW+EFCGCegEBAQ X-IPAS-Result: Au0MAOatTlRFpY87/2dsb2JhbABcgw6DYoZ+y1MEAgKBHBcBAXyEAwEBAwFWIxALNBIUGA0kiEsJy3IBAQEBBgIBH5EIB4RLBbIggW+EFCGCegEBAQ X-IronPort-AV: E=Sophos;i="5.04,797,1406606400"; d="scan'208";a="95519867" Original-Received: from 69-165-143-59.dsl.teksavvy.com (HELO pastel.home) ([69.165.143.59]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Oct 2014 12:45:59 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id E3F527ABE; Wed, 29 Oct 2014 12:45:58 -0400 (EDT) In-Reply-To: <83mw8f0w08.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 29 Oct 2014 16:51:35 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:176019 gmane.lisp.gcl.devel:8791 Archived-At: >> Yet setting string elements can trigger reallocations/memmove >> operations. > Emacs, as every editor, needs to handle this efficiently anyway, > because editing operations rarely leave the buffer size unchanged. So > Emacs uses a gap to minimize reallocations. To clarify: Emacs handles modification of strings naively (reallocate+memmove), but it doesn't matter much because these are almost never used (my own local Emacs actually completely disallows them, and I very rarely bump into problems because of it). All "string modifications" instead take place in buffers where we can efficiently insert/delete/replace text. Stefan