Opened 11 years ago

Last modified 6 months ago

#1290 new bug

ghc runs preprocessor too much

Reported by: guest Owned by:
Priority: normal Milestone:
Component: Driver Version: 6.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


When an external preprocessor has been specified with -F -pgmF, and then using ghc --make, ghc runs the preprocessor on every .hs file, even those for which compilation is skipped. This seem unnecessary and it slows down recompilation significantly when you have many files.

-- Lennart

Change History (11)

comment:1 Changed 11 years ago by simonmar

I don't see how to avoid this easily: we need to parse the imports of every source file in order to construct the dependency tree, and we can't parse the imports without preprocessing the source file first.

Perhaps keeping a cache file containing the imports for each source file with the last-modified date of the source?

comment:2 Changed 11 years ago by guest

Yes, you're right. It's difficult to fix. It would take a cache to avoid, which is a pain.

comment:3 Changed 11 years ago by igloo

Milestone: _|_

comment:4 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:5 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:6 Changed 5 years ago by morabbin

Type of failure: None/Unknown

Still difficult ...

comment:7 Changed 2 years ago by ezyang

Milestone: 7.12.1

What if this information was cached in the interface file? Essentially, interface files should contain enough information for us to construct a ModSummary, and they are as recent as the source file we can just use this directly. (And we're going to read the interface file anyway shortly thereafter do check for recompilation avoidance.)

comment:8 Changed 2 years ago by thoughtpolice


Milestone renamed

comment:9 Changed 2 years ago by ezyang

This is related to #618, as if ghc --make remembered dependency information it would not need to preprocess *stable* modules.

comment:10 Changed 22 months ago by thomie

Milestone: 8.0.1

comment:11 Changed 6 months ago by bgamari

Type of failure: None/UnknownCompile-time performance bug
Note: See TracTickets for help on using tickets.