From 41b8f31bcd299d4ea7dd40138f725f77576278a3 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 5 Dec 2016 10:03:58 -0800 Subject: Use JSON for the database instead of YAML. (#2189) * Use JSON for the database instead of YAML. - JSON is much faster than YAML *and* can preserve ordered keys. - 170x+ faster than Python YAML when using unordered dicts - 55x faster than Python YAML (both using OrderedDicts) - 8x faster than C YAML (with OrderedDicts) - JSON is built into Python, unlike C YAML, so doesn't add a dependency. - Don't need human readability for the package database. - JSON requires no major changes to the code -- same object model as YAML. - add to_json, from_json methods to spec. * Add tests to ensure JSON and YAML don't need to be ordered in DB. * Write index.json first time it's not found instead of requiring reindex. * flake8 bug. --- bin/spack | 8 -------- 1 file changed, 8 deletions(-) (limited to 'bin') diff --git a/bin/spack b/bin/spack index 7cc1b28a37..454a9a5b2d 100755 --- a/bin/spack +++ b/bin/spack @@ -41,14 +41,6 @@ SPACK_PREFIX = os.path.dirname(os.path.dirname(SPACK_FILE)) SPACK_LIB_PATH = os.path.join(SPACK_PREFIX, "lib", "spack") sys.path.insert(0, SPACK_LIB_PATH) -# Try to use system YAML if it is available, as it might have libyaml -# support (for faster loading via C). Load it before anything in -# lib/spack/external so it will take precedence over Spack's PyYAML. -try: - import yaml -except ImportError: - pass # ignore and use slow yaml - # Add external libs SPACK_EXTERNAL_LIBS = os.path.join(SPACK_LIB_PATH, "external") sys.path.insert(0, SPACK_EXTERNAL_LIBS) -- cgit v1.2.3-70-g09d2