From: Eli Zaretskii <eliz@gnu.org>
To: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Enlarge MAX_ALLOCA?
Date: Thu, 19 Jun 2014 20:14:56 +0300 [thread overview]
Message-ID: <83oaxostwv.fsf@gnu.org> (raw)
In-Reply-To: <877g4c96gm.fsf@fencepost.gnu.org>
> From: David Kastrup <dak@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Thu, 19 Jun 2014 19:04:09 +0200
>
> >> If there is a hard limit due to short offsets or similar (and if
> >> there weren't, why bother at all?), then allocating a full 64kB
> >> might be a bad idea.
> >
> > Is there really such a system? If so, which one?
>
> Either your limit has a rationale in machine architectures or not. If
> it has: the C standard guarantees that you are allowed to take the
> address _after_ an array.
>
> The 68k architecture has short offsets (-32768..+32767) for addressing
> off an address register such as the stack pointer.
But we don't support 68k anymore, AFAIK.
> >> 64kB feels arbitrary.
> >
> > I explained my rationale for choosing this value.
>
> The explanation was:
>
> > Why 64KB? Because that's the size of the work area coding.c allocates
> > whenever it needs to encode or decode something. It turns out we do
> > this a lot, e.g., every redisplay calls file-readable-p on the icon
> > image files, which needs to encode the file name. While the work area
> > is immediately free'd, I think allocating such a large buffer so much
> > has a potential of creating an unnecessary memory pressure on
> > 'malloc', and perhaps cause excess fragmentation and/or enlarge memory
> > footprint in some cases.
>
> That's not related to an architecture restraint. In fact, it merely
> follows the arbitrary definition
>
> #define CHARBUF_SIZE 0x4000
Indeed. As I stated.
> Arbitrary because this is not a lookup table size but a buffer size for
> portioned conversion. Instead of doubling MAX_ALLOCA, it would seem to
> make more sense to reduce CHARBUF_SIZE to something making it fit better
> on the stack if this is performance relevant.
I don't think CHARBUF_SIZE is too arbitrary, but I will let the
experts explain why they chose it.
> As I said: there are architectural reasons (short addressing mode)
> making somewhat less than 32kB a good choice on some architectures.
But do we support such architectures? I think we don't.
next prev parent reply other threads:[~2014-06-19 17:14 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-19 16:02 Enlarge MAX_ALLOCA? Eli Zaretskii
2014-06-19 16:23 ` David Kastrup
2014-06-19 16:48 ` Eli Zaretskii
2014-06-19 17:04 ` David Kastrup
2014-06-19 17:14 ` Eli Zaretskii [this message]
2014-06-19 17:36 ` David Kastrup
2014-06-19 17:51 ` Eli Zaretskii
2014-06-19 18:21 ` Stefan Monnier
2014-06-19 21:13 ` David Kastrup
2014-06-20 7:10 ` Eli Zaretskii
2014-06-20 8:08 ` David Kastrup
2014-06-20 8:38 ` Dmitry Antipov
2014-06-20 8:56 ` Eli Zaretskii
2014-06-20 9:26 ` Andreas Schwab
2014-06-20 9:38 ` David Kastrup
2014-06-19 18:28 ` Stefan Monnier
2014-06-19 18:38 ` Eli Zaretskii
2014-06-19 20:37 ` Stefan Monnier
2014-06-20 7:08 ` Eli Zaretskii
2014-06-20 13:02 ` Stefan Monnier
2014-06-20 13:18 ` Eli Zaretskii
2014-06-20 14:43 ` Stefan Monnier
2014-06-20 14:50 ` Eli Zaretskii
2014-06-20 15:15 ` Herring, Davis
2014-06-20 15:44 ` Dmitry Antipov
2014-06-20 18:36 ` Eli Zaretskii
2014-06-21 13:01 ` K. Handa
2014-06-21 13:59 ` Eli Zaretskii
2014-06-21 17:08 ` Stefan Monnier
2014-06-22 9:22 ` K. Handa
2014-06-28 14:15 ` K. Handa
2014-06-28 14:38 ` Eli Zaretskii
2014-06-21 15:19 ` David Kastrup
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=83oaxostwv.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=dak@gnu.org \
--cc=emacs-devel@gnu.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).