desc = '''Generate HTML output to visualize optimization records from the YAML files
generated with -fsave-optimization-record and -fdiagnostics-show-hotness.
-The tools requires PyYAML and Pygments Python packages.'''
+The tools requires PyYAML and Pygments Python packages.
+
+For faster parsing, you may want to use libYAML with PyYAML.'''
import yaml
+# Try to use the C parser.
+try:
+ from yaml import CLoader as Loader
+except ImportError:
+ from yaml import Loader
import argparse
import os.path
import re
class Remark(yaml.YAMLObject):
max_hotness = 0
+ # Work-around for http://pyyaml.org/ticket/154.
+ yaml_loader = Loader
+
@classmethod
def should_display_hotness(cls):
# If max_hotness is 0 at the end, we assume hotness information is
for input_file in args.yaml_files:
f = open(input_file)
- docs = yaml.load_all(f)
+ docs = yaml.load_all(f, Loader=Loader)
for remark in docs:
# Avoid remarks withoug debug location or if they are duplicated
if not hasattr(remark, 'DebugLoc') or remark.key in all_remarks: