unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Stephen J. Turnbull" <stephen@xemacs.org>
Cc: raeburn@raeburn.org, qguo@ualberta.ca, emacs-devel@gnu.org
Subject: Re: Quesition about Lisp_Vector
Date: Sat, 12 Nov 2011 10:49:45 +0200	[thread overview]
Message-ID: <83mxc1g1xy.fsf@gnu.org> (raw)
In-Reply-To: <87ty6aj9al.fsf@uwakimon.sk.tsukuba.ac.jp>

> From: "Stephen J. Turnbull" <stephen@xemacs.org>
> Date: Sat, 12 Nov 2011 12:42:42 +0900
> Cc: Qiang Guo <qguo@ualberta.ca>, emacs-devel@gnu.org
> 
> Aside to OP: In Emacs Lisp although strings (ie, arrays with bytes as
> elements and a non-uniform indexing scheme) are vectors in the API,
> they don't share an implementation with general vectors.  In fact the
> string storage is allocated separately (another optimization, because
> strings with len(data) % pointersize != 0 would waste substantial
> amounts of memory, at least by 1980 standards), so there's always a
> pointer indirection.  This usually is not too inefficient since many
> operations on strings are of the form "get string data, do O(len)
> operation on it", so the overhead of a pointer dereference to "get
> string data" is tolerable.

Having string data accessible through indirection allows to relocate
strings without affecting callers who have references to Lisp strings
in local variables.  (This is similar to the ability to relocate
buffer text, because buffer text is also accessed through
indirection.)  These abilities are important, because strings, like
buffers, can be large, so being able to relocate them during GC helps
making more efficient use of the available memory.



  reply	other threads:[~2011-11-12  8:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-11  6:29 Quesition about Lisp_Vector Qiang Guo
2011-11-11  8:59 ` Andreas Schwab
2011-11-11  9:01 ` Ken Raeburn
2011-11-12  3:42   ` Stephen J. Turnbull
2011-11-12  8:49     ` Eli Zaretskii [this message]
2011-11-12 15:45       ` Stephen J. Turnbull
2011-11-12 15:53         ` Eli Zaretskii
2011-11-13  1:02     ` Ken Raeburn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83mxc1g1xy.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=qguo@ualberta.ca \
    --cc=raeburn@raeburn.org \
    --cc=stephen@xemacs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).