[m-rev.] for post-commit review: ground terms as constant structures

Zoltan Somogyi zs at unimelb.edu.au
Mon Jun 18 17:51:03 AEST 2012


On 18-Jun-2012, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>> If the backend supports constant structures, and we do not need 
>> unifications
>> to retain their original shapes, then convert each from_ground_term scope
>> into a unification with a cons_id that represents the ground term being
>> built up.
>>
>> This speeds up the compilation of training_cars_full.m by about 6%.
>
> Out of interest, how does the compiler now perform on this benchmark?

On my laptop, it now compiles in just over seven seconds. Almost half of that
is in typecheck. I have an idea for how to speed that up, a change that would
help almost all programs, but I won't have time to work on it in the next
couple of weeks.

I attach the output of the compiler when compiling this program.

>>         % The only valid higher-order unifications are assignments.
>>         % For the purposes of the IR analysis, we can ignore them.
>>         % We can also ignore unifications that build constant terms.
>> +        % XXX Should we process constant terms that are NOT typeinfos
>> +        % or typeclass infos? We have no test cases (yet) that need that.
>
> Yes -- I will fix this one.

Thanks.

Zoltan.
-------------- next part --------------
% Parsing file `training_cars_full' and imported interfaces...
% Module qualifying items...
% done.
[User time: +0.310s, 0.310s, Real time: +0.338s, 0.338s, C Stack: 3.540k,
#GCs: 10, Heap used since last GC: 10210.875k, Total used: 33532.000k]
% Expanding equivalence types...
% done.
[User time: +0.010s, 0.320s, Real time: +0.001s, 0.339s, C Stack: 3.540k,
#GCs: 10, Heap used since last GC: 10759.078k, Total used: 33532.000k]
% Converting parse tree to hlds...
% Processed all items in pass 1
[User time: +0.040s, 0.360s, Real time: +0.040s, 0.379s, C Stack: 3.837k,
#GCs: 11, Heap used since last GC: 740.328k, Total used: 33532.000k]
% Processed all items in pass 2
[User time: +0.000s, 0.360s, Real time: +0.003s, 0.382s, C Stack: 3.837k,
#GCs: 11, Heap used since last GC: 1629.547k, Total used: 33532.000k]
% Processed all items in pass 3
% done.
[User time: +0.990s, 1.350s, Real time: +1.032s, 1.414s, C Stack: 3.540k,
#GCs: 17, Heap used since last GC: 34516.469k, Total used: 141540.000k]
% Writing auto-dependency file `training_cars_full.d'... done.
% Post-processing type definitions...
% Checking typeclasses...
% Checking instance declaration types...
% Checking typeclass instances...
% Checking for cyclic classes...
% Checking for missing concrete instances...
% Checking functional dependencies on instances...
% Checking typeclass constraints...
% Checking that insts have matching types... done.
% Type-checking...
% Type-checking clauses...
% Program is type-correct.
[User time: +4.570s, 5.920s, Real time: +4.656s, 6.070s, C Stack: 3.618k,
#GCs: 26, Heap used since last GC: 43019.734k, Total used: 272612.000k]
% Purity-checking clauses...
[User time: +0.760s, 6.680s, Real time: +0.793s, 6.863s, C Stack: 3.618k,
#GCs: 27, Heap used since last GC: 2322.109k, Total used: 305380.000k]
% Program is purity-correct.
[User time: +0.000s, 6.680s, Real time: +0.000s, 6.863s, C Stack: 3.618k,
#GCs: 27, Heap used since last GC: 2322.109k, Total used: 305380.000k]
% Substituting implementation-defined literals...
% done.
[User time: +0.020s, 6.700s, Real time: +0.023s, 6.886s, C Stack: 3.618k,
#GCs: 27, Heap used since last GC: 6025.047k, Total used: 305380.000k]
% Transforming polymorphic unifications... done.
[User time: +0.170s, 6.870s, Real time: +0.164s, 7.050s, C Stack: 4.165k,
#GCs: 27, Heap used since last GC: 42414.672k, Total used: 305380.000k]
% Mode-checking clauses...
[User time: +0.770s, 7.640s, Real time: +0.798s, 7.848s, C Stack: 4.243k,
#GCs: 28, Heap used since last GC: 75408.547k, Total used: 354532.000k]
% Program is mode-correct.
[User time: +0.000s, 7.640s, Real time: +0.000s, 7.848s, C Stack: 4.165k,
#GCs: 28, Heap used since last GC: 75409.000k, Total used: 354532.000k]
% Detecting switches...
% done.
[User time: +0.020s, 7.660s, Real time: +0.014s, 7.862s, C Stack: 4.165k,
#GCs: 28, Heap used since last GC: 79688.312k, Total used: 354532.000k]
% Detecting common deconstructions...
% done.
[User time: +0.010s, 7.670s, Real time: +0.007s, 7.869s, C Stack: 4.165k,
#GCs: 28, Heap used since last GC: 81660.531k, Total used: 354532.000k]
% Doing determinism checking...
% done.
% Program is determinism-correct.
[User time: +0.020s, 7.690s, Real time: +0.022s, 7.891s, C Stack: 4.165k,
#GCs: 28, Heap used since last GC: 87327.000k, Total used: 354532.000k]
% Checking for backtracking over unique modes...
% Program is unique-mode-correct.
[User time: +0.040s, 7.730s, Real time: +0.073s, 7.964s, C Stack: 4.165k,
#GCs: 28, Heap used since last GC: 106200.406k, Total used: 370916.000k]
% Transforming try goals...
% done.
[User time: +0.000s, 7.730s, Real time: +0.000s, 7.964s, C Stack: 4.165k,
#GCs: 28, Heap used since last GC: 106202.375k, Total used: 370916.000k]
% Simplifying goals...
% done.
[User time: +1.350s, 9.080s, Real time: +1.393s, 9.357s, C Stack: 4.306k,
#GCs: 29, Heap used since last GC: 59670.609k, Total used: 420068.000k]
% Transforming tabled predicates... done.
[User time: +0.000s, 9.080s, Real time: +0.000s, 9.357s, C Stack: 3.837k,
#GCs: 29, Heap used since last GC: 59719.547k, Total used: 420068.000k]
% Transforming lambda expressions... done.
[User time: +0.010s, 9.090s, Real time: +0.004s, 9.361s, C Stack: 3.837k,
#GCs: 29, Heap used since last GC: 61548.672k, Total used: 420068.000k]
% Transforming stm expressions... done.
[User time: +0.000s, 9.090s, Real time: +0.006s, 9.367s, C Stack: 3.837k,
#GCs: 29, Heap used since last GC: 64363.500k, Total used: 420068.000k]
% Fully expanding equivalence types... done.
[User time: +0.040s, 9.130s, Real time: +0.038s, 9.405s, C Stack: 3.837k,
#GCs: 29, Heap used since last GC: 72537.234k, Total used: 420068.000k]
% Generating type_ctor_info structures... done.
[User time: +0.000s, 9.130s, Real time: +0.000s, 9.405s, C Stack: 3.837k,
#GCs: 29, Heap used since last GC: 72546.828k, Total used: 420068.000k]
% Specializing higher-order and polymorphic predicates...
% done.
[User time: +0.010s, 9.140s, Real time: +0.004s, 9.409s, C Stack: 3.915k,
#GCs: 29, Heap used since last GC: 73507.500k, Total used: 420068.000k]
% Inlining...
% done.
[User time: +0.210s, 9.350s, Real time: +0.233s, 9.642s, C Stack: 3.931k,
#GCs: 29, Heap used since last GC: 143001.234k, Total used: 452836.000k]
% Eliminating dead procedures...
% done.
[User time: +0.780s, 10.130s, Real time: +0.793s, 10.435s, C Stack: 3.837k,
#GCs: 30, Heap used since last GC: 16797.656k, Total used: 501988.000k]
% Updating interface:
% training_cars_full.mh' has not changed.
% Mapping args to regs... done.
[User time: +0.010s, 10.140s, Real time: +0.005s, 10.440s, C Stack: 3.415k,
#GCs: 30, Heap used since last GC: 18203.078k, Total used: 501988.000k]
% Migrating branch code... done.
[User time: +0.000s, 10.140s, Real time: +0.001s, 10.441s, C Stack: 3.415k,
#GCs: 30, Heap used since last GC: 18497.328k, Total used: 501988.000k]
% Simplifying goals...
% done.
[User time: +0.030s, 10.170s, Real time: +0.027s, 10.468s, C Stack: 3.556k,
#GCs: 30, Heap used since last GC: 26405.062k, Total used: 501988.000k]
% Computing liveness...
% done.
[User time: +0.080s, 10.250s, Real time: +0.085s, 10.553s, C Stack: 3.415k,
#GCs: 30, Heap used since last GC: 67241.891k, Total used: 501988.000k]
% Computing stack vars... done.
[User time: +0.010s, 10.260s, Real time: +0.010s, 10.563s, C Stack: 3.415k,
#GCs: 30, Heap used since last GC: 70415.922k, Total used: 501988.000k]
% Allocating store map... done.
[User time: +0.010s, 10.270s, Real time: +0.007s, 10.570s, C Stack: 3.415k,
#GCs: 30, Heap used since last GC: 72580.266k, Total used: 501988.000k]
% Generating code...
% done.
[User time: +0.500s, 10.770s, Real time: +0.504s, 11.074s, C Stack: 3.415k,
#GCs: 30, Heap used since last GC: 203558.750k, Total used: 501988.000k]
% Generating call continuation information... done.
[User time: +0.000s, 10.770s, Real time: +0.000s, 11.074s, C Stack: 3.415k,
#GCs: 30, Heap used since last GC: 203558.750k, Total used: 501988.000k]
% Doing optimizations...
% done.
[User time: +0.960s, 11.730s, Real time: +0.957s, 12.031s, C Stack: 3.415k,
#GCs: 31, Heap used since last GC: 24744.281k, Total used: 502500.000k]
% Generating layout data... done.
[User time: +0.000s, 11.730s, Real time: +0.000s, 12.031s, C Stack: 3.743k,
#GCs: 31, Heap used since last GC: 24749.531k, Total used: 502500.000k]
% Writing output to `training_cars_full.c'... done.
[User time: +0.210s, 11.940s, Real time: +0.334s, 12.365s, C Stack: 3.743k,
#GCs: 31, Heap used since last GC: 36686.688k, Total used: 502500.000k]
% Updating interface:
% training_cars_full.mh' has not changed.
% Touching `training_cars_full.c_date'...  done.


More information about the reviews mailing list