From: Paul Eggert <eggert@cs.ucla.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Dmitry Antipov <dmantipov@yandex.ru>, emacs-devel@gnu.org
Subject: Re: Proposal: immediate strings
Date: Wed, 23 May 2012 23:08:15 -0700 [thread overview]
Message-ID: <4FBDD04F.9010203@cs.ucla.edu> (raw)
In-Reply-To: <jwvk402dvsf.fsf-monnier+emacs@gnu.org>
On 05/23/2012 10:17 PM, Stefan Monnier wrote:
> maybe we can move both the mark bit and the immbit into the `intervals'
> fields (after all, we know those are aligned on a multiple of at least
> 4 on all architectures on which Emacs is known to run, so we have
> 2 bits free for (ab)use there).
That might work. But this raises another idea: assuming most tiny strings
don't have text properties, won't it improve performance overall if
any string with text properties is forced to be an ordinary string, so
that immediate strings can reuse the rarely-used 'intervals' member
for data?
Another thought that comes to mind, is that we could leave
the mark bit where it is (the most significant bit of 'size'),
and reserve 'size' values >= (EMACS_INT / 2 & ~0xffff)
to represent immediate strings, with the size and size_bytes
values packed into the low-order 16 bits of 'size'.
Something like this:
struct Lisp_String
{
EMACS_INT size;
union
{
struct Ordinary_Lisp_String_Component
{
EMACS_INT size_byte;
INTERVAL intervals;
unsigned char *data;
} ordinary;
unsigned char data[sizeof (struct Ordinary_Lisp_String_Component)];
} u;
};
#define IMMEDIATE_STRING(s) (EMACS_INT_MAX & ~0xffff <= (s)->size)
#define SDATA(s) (IMMEDIATE_STRING (XSTRING (s)) \
? XSTRING (s)->data \
: XSTRING (s)->ordinary.data)
#define SCHARS(s) (IMMEDIATE_STRING (XSTRING (s)) \
? XSTRING (s)->size & 0xff
: XSTRING (s)->size)
#define SBYTES(s) (IMMEDIATE_STRING (XSTRING (s)) \
? (XSTRING (s)->size >> 8) & 0xff
: STRING_BYTES (XSTRING (s)))
etc.
next prev parent reply other threads:[~2012-05-24 6:08 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-22 8:44 Proposal: immediate strings Dmitry Antipov
2012-05-22 20:51 ` Miles Bader
2012-05-22 22:13 ` Paul Eggert
2012-05-24 5:17 ` Stefan Monnier
2012-05-24 5:41 ` Ken Raeburn
2012-05-24 5:50 ` Miles Bader
2012-05-24 6:08 ` Paul Eggert [this message]
2012-05-24 7:14 ` Stefan Monnier
2012-05-24 7:52 ` Paul Eggert
2012-05-24 12:51 ` Stefan Monnier
2012-05-24 16:35 ` Paul Eggert
2012-05-25 6:43 ` Dmitry Antipov
2012-05-25 7:30 ` Paul Eggert
2012-05-28 11:32 ` Dmitry Antipov
2012-05-28 14:25 ` Stefan Monnier
2012-05-29 6:55 ` Dmitry Antipov
2012-05-29 7:38 ` Paul Eggert
2012-05-29 13:33 ` Dmitry Antipov
2012-05-29 15:24 ` Paul Eggert
2012-05-31 9:28 ` Dmitry Antipov
2012-05-31 16:34 ` Paul Eggert
2012-06-06 6:14 ` Dmitry Antipov
2012-06-06 6:41 ` Paul Eggert
2012-06-06 7:29 ` Dmitry Antipov
2012-06-06 15:14 ` Eli Zaretskii
2012-06-06 21:44 ` Paul Eggert
2012-07-04 8:27 ` Old topic(s) again [was: Re: Proposal: immediate strings] Dmitry Antipov
2012-07-04 13:08 ` Stefan Monnier
2012-07-04 19:32 ` Paul Eggert
2012-05-29 7:38 ` Proposal: immediate strings Andreas Schwab
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FBDD04F.9010203@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=dmantipov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.