From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Alan Mackenzie <acm@muc.de>
Cc: Alan Mackenzie <bug-cc-mode@gnu.org>,
Martin Stjernholm <mast@lysator.liu.se>,
emacs-devel@gnu.org
Subject: Re: Avoiding loading cc-langs
Date: Wed, 03 Sep 2014 22:38:09 -0400 [thread overview]
Message-ID: <jwvr3zsxhh8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <jwvegvvezhi.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 01 Sep 2014 18:43:37 -0400")
> In my attempt to understand a bit more how cc-mode works, here's the
> next question:
> - why do we work so hard to try and make cc-langs unnecessary at run-time?
> I mean, if you look at c-lang-const, or c-make-init-lang-vars-fun,
> you'll see we have up to 3 different ways to do the same thing in
> different circumstances.
> Is it only for performance reasons?
Digging further into this: I have now a patch which gets rid of this
"pre-compute cc-langs stuff and hardcode it into cc-mode.elc and
cc-fonts.elc", by computing those things dynamically at
run-time instead.
The naive way to do that leads to a problem, tho: some of the computed
elements are functions which are then byte-compiled, so if we do that
dynamically, we end up calling the byte-compiler at run-time, which
increases the startup time significantly (almost double for an empty
c-mode file).
Luckily, it turns out that those functions we dynamically byte-compile
don't run noticeably slower when not byte-compiled (99% of their
run-time is spent in other functions, e.g. the regexp-matcher).
So if we refrain from byte-compiling them, the result is a simpler setup
that starts just a bit slower (on my test machine, enabling c-mode for
the first time, in an empty buffer takes 0.56s instead of 0.47s).
One of the main benefits I see of those two changes (setting things up
more dynamically and not calling the byte-compiler explicitly) is that
it should make most of the cc-bytecomp horror completely useless (some
of its main purpose is to propagate a compiling environment from one
place to another, e.g. to the compiler called explicitly). I haven't
yet investigated this part, tho, admittedly.
It should also make cc-mode's build dependencies sufficiently normal
that we don't need any special Makefile.in rules for cc-mode any more.
Stefan
next prev parent reply other threads:[~2014-09-04 2:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 14:09 Ordering in `source' property, and auto-loading of c-lang-defconsts Stefan Monnier
2014-08-31 21:23 ` Alan Mackenzie
2014-09-01 0:52 ` Stefan Monnier
2014-09-01 22:43 ` Avoiding loading cc-langs (was: Ordering in `source' property, and auto-loading of c-lang-defconsts) Stefan Monnier
2014-09-04 2:38 ` Stefan Monnier [this message]
2014-09-06 11:10 ` Avoiding loading cc-langs Alan Mackenzie
2014-09-06 10:12 ` Avoiding loading cc-langs (was: Ordering in `source' property, and auto-loading of c-lang-defconsts) Alan Mackenzie
2014-09-08 1:51 ` Avoiding loading cc-langs Stefan Monnier
2014-09-08 15:46 ` Glenn Morris
2014-09-08 18:45 ` Stefan Monnier
2014-09-08 18:52 ` Glenn Morris
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=jwvr3zsxhh8.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=acm@muc.de \
--cc=bug-cc-mode@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=mast@lysator.liu.se \
/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).