all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Yates <john@yates-sheets.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Dmitry Antipov <dmantipov@yandex.ru>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: Optimize glyph row clearing and copying routines
Date: Tue, 24 Sep 2013 09:40:53 -0400	[thread overview]
Message-ID: <CAJnXXojfwVaoqgnMFzbnVEn7nHxbUUZoCXtOs1iuTUpQB-Umuw@mail.gmail.com> (raw)
In-Reply-To: <83a9j2iv6o.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]

It is true that the standard's definition of memcpy is in terms of copying
a sequence of bytes.  It is also true that memcpy is one of the most
important and most heavily optimized library functions.

These days any credible compiler has a means of determining that an
invocation of a function named 'memcpy' is actually an invocation of the
standard's memcpy.  E.g. gcc's exposed memcpy is an inline whose body
simply calls __builtin_memcpy.

With such knowledge a compiler can bring to bear all kinds of
optimizations.  Dmitry's measurements seem to bear this out.

/john


On Tue, Sep 24, 2013 at 2:35 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> Does this change really speed up the code?  AFAIU, previously the
> struct assignment could use word-size copies (because a struct is
> always aligned), but now you cast the arguments to 'char *' and use
> memcpy, which could fall back on copying single bytes or shorter
> words.
>
> Did you measure the impact?  Was it significant enough to justify this
> change?
>
>

[-- Attachment #2: Type: text/html, Size: 1446 bytes --]

  parent reply	other threads:[~2013-09-24 13:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-24  6:35 Optimize glyph row clearing and copying routines Eli Zaretskii
2013-09-24 10:10 ` Dmitry Antipov
2013-09-24 11:50   ` Eli Zaretskii
2013-09-24 12:42     ` Dmitry Antipov
2013-09-24 13:40 ` John Yates [this message]
2013-09-24 17:04   ` Eli Zaretskii
2013-09-24 17:28     ` John Yates
2013-09-24 18:03     ` Paul Eggert
2013-09-24 18:32       ` Eli Zaretskii
2013-09-26 12:35         ` Juanma Barranquero

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=CAJnXXojfwVaoqgnMFzbnVEn7nHxbUUZoCXtOs1iuTUpQB-Umuw@mail.gmail.com \
    --to=john@yates-sheets.org \
    --cc=dmantipov@yandex.ru \
    --cc=eliz@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 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.