Bug 4325 - [PATCH] xrdb should use mcpp if it's available
Summary: [PATCH] xrdb should use mcpp if it's available
Alias: None
Product: xorg
Classification: Unclassified
Component: App/xrdb (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high enhancement
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
Keywords: patch
Depends on:
Reported: 2005-08-31 11:03 UTC by Lorenzo Colitti
Modified: 2011-10-15 16:31 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:

Try preferred preprocessors before falling back to CPP (2.23 KB, patch)
2005-08-31 16:13 UTC, Lorenzo Colitti
no flags Details | Splinter Review

Description Lorenzo Colitti 2005-08-31 11:03:11 UTC
Every time xrdb is called it spawns cpp, which is a 4MB binary.

This is overkill for simply parsing X resource files and slows down X startup
time. If I replace calls to 'xrdb -merge' with 'xrdb -cpp mcpp -merge' I get a
~1 second startup time improvement (from when I type my password to when the
disk stops spinning, under gnome).

xrdb should check if mcpp is available at compile time, and if so use that.
Comment 1 Jim Gettys 2005-08-31 11:04:36 UTC
Got a patch?
Comment 2 Lorenzo Colitti 2005-08-31 11:06:22 UTC
No, I would need to understand how imake works first. :(

But I'll come up with such a patch if it's likely to be accepted...
Comment 3 Jim Gettys 2005-08-31 11:09:00 UTC
The other problem is: how common is mcpp installed, anyway?  It certainly isn't
installed by default on my ubuntu system.
Comment 4 Jim Gettys 2005-08-31 11:12:51 UTC
Also, on my system cpp looks to be the same size as mcpp: 90K bytes.

So where is this problem, again?
Comment 5 Lorenzo Colitti 2005-08-31 11:19:05 UTC
It's not installed by default, but there are Debian and Ubuntu packages for it.
I don't know about fedora.

Regarding size, ccp is 90k but on my system it vforks and execs
/usr/lib/gcc/i486-linux-gnu/4.0.2/cc1, which on my system is 4.3M

You can see this with "strace -f cpp"
Comment 6 Lorenzo Colitti 2005-08-31 16:13:22 UTC
Created attachment 3142 [details] [review]
Try preferred preprocessors before falling back to CPP

Tries the preprocessors in the preferred_cpps variable one by one and runs the
first one it finds. If there are no preprocessors or if none can be found, it
falls back to the CPP defined at compile time.

The list of preferred preprocessors defaults to "mccp"
Comment 7 Matthieu Herrb 2005-10-03 13:36:45 UTC
I disagree with this approach. X should use standard utilities as much as possible.
If you want to micro-optimize things this way, you already have all the knobs
It is also possible to specify CppCmd=/usr/bin/mcpp in host.def (or add support
for the autoconf build) for this kind of use.
Comment 8 Lorenzo Colitti 2005-10-03 14:42:41 UTC
Originally I had considered detecting the cpp binary at compile time, but then
if it were uninstalled xrdb would break completely, which is even worse.

With the runtime check, it just works if mcpp (or any other compiler you want to
put into the list) is present, and falls back gracefully if not.
Comment 9 Erik Andren 2006-04-18 05:10:12 UTC
Added patch keyword
Comment 10 Daniel Stone 2006-06-03 02:16:43 UTC
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=339683 blocks this: it makes
mcpp useless for xrdb without that patch, which seems to be seriously bitrotting.
Comment 11 Daniel Stone 2007-02-27 01:27:51 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 12 Jerome Warnier 2007-12-16 13:42:10 UTC
I originally wrote a patch for startup scripts instead of build-time.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=343828.
Comment 13 Matt Turner 2010-12-03 12:55:41 UTC
Patch doesn't apply. Bug is totally inactive. Closing.

If you want to revive this, please send a patch to xorg-devel@lists.x.org.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.