mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
compiler/simplify_info.m:
Improve the simplify_info structure in several ways:
- Put the readonly fields into a substructure of their own, so they
don't have to be copied every time a writeable field is actually written.
- Look up the trace level and the value of the trace_optimized flag
just once per simplification invocation, not once per conjunction.
Having separated out the readonly fields makes the cost of this
negligible.
- Store the pred_id and proc_id of the procedure being simplified
together, since most uses of them *need* them together.
- Use benchmarking data to decide which fields are used most frequently,
and should therefore be stored at the top level.
- Use all eight slots in a Boehm allocated block at the top level.
- For some of the writeable fields, when the field is set, the new value
is frequently the same as the old value. In such cases, return the
old structure unchanged, instead of allocating a new structure
and filling it with identical content.
Add a comment giving both the benchmarking code and the data derived
from it, since it may be useful in the future.
tools/info_stats.awk:
The script that summarizes the raw data output by the benchmarking code
mentioned above.
compiler/det_util.m:
Store the pred_id and proc_id of the procedure being analysed together,
since most uses of them *need* them together.
compiler/simplify_goal_conj.m:
Conform to the above changes, and optimize some related code.
compiler/det_analysis.m:
compiler/det_report.m:
compiler/pd_util.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_unify.m:
compiler/simplify_proc.m:
Conform to the above changes.
36 lines
1.0 KiB
Awk
Executable File
36 lines
1.0 KiB
Awk
Executable File
#!/usr/bin/awk -f
|
|
BEGIN {
|
|
NUM_FIELDS = 100;
|
|
for (i = 0; i < NUM_FIELDS ; i++)
|
|
{
|
|
read[i] = 0;
|
|
same[i] = 0;
|
|
diff[i] = 0;
|
|
}
|
|
}
|
|
$1 == "stat_rsd" {
|
|
read[$2] += $3;
|
|
same[$2] += $4;
|
|
diff[$2] += $5;
|
|
}
|
|
END {
|
|
printf("%2s %9s %9s %9s %7s\n",
|
|
"i", "read", "same", "diff", "same%");
|
|
for (i = 0; i < NUM_FIELDS; i++)
|
|
{
|
|
if (read[i] != 0 || same[i] != 0 || diff[i] != 0)
|
|
{
|
|
printf("%2d %9d %9d %9d", i, read[i], same[i], diff[i]);
|
|
if (0 + same[i] + diff[i] > 0)
|
|
{
|
|
printf(" %6.2f%%\n",
|
|
(100.0 * same[i]) / (same[i] + diff[i]));
|
|
}
|
|
else
|
|
{
|
|
printf("\n");
|
|
}
|
|
}
|
|
}
|
|
}
|