[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimize glyph row clearing and copying routines

From: Eli Zaretskii
Subject: Re: Optimize glyph row clearing and copying routines
Date: Tue, 24 Sep 2013 21:32:35 +0300

> Date: Tue, 24 Sep 2013 11:03:32 -0700
> From: Paul Eggert <address@hidden>
> The new code does have an advantage of clarity.

I don't think I agree.  The new code is _simpler_, allright, but it
obfuscates the meaning:

  enum { off = offsetof (struct glyph_row, x) };

  memcpy (&to->x, &from->x, sizeof *to - off);

You will not understand what is going on, until you look up the
definition of 'struct glyph_row' (on another file), and find out that
the members mentioned in the commentary (IF you've read the
commentary) are all before 'x' in the struct layout.

In the old, all this was explicit in the source code.

> The old code squirreled away some stuff in a temporary copy
> and then copied it back, which was hard to follow,
> whereas the new code simply copies from source to
> destination.  This may be worth any minor performance loss.

I don't see any advantages either way, so I think we are talking
stylistic preferences here.  Making changes just because one doesn't
like the existing style is maintenance burden and waste of energy.  It
does have one clear disadvantage: it makes the familiar code no longer
that, and makes it harder to merge from long-living branches.

In general, I'm amazed how much of the changes lately are minor
changes due to obscure or stylistic issues, with no real gain in

reply via email to

[Prev in Thread] Current Thread [Next in Thread]