From 56d048320a358b2c417cdb2211b3640394a182e9 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Wed, 3 Jul 2013 21:19:13 +0200 Subject: store hash values as sqlite BLOB They were previously hex encoded, so this should cut the space consumed by hashes in half. A first benchmark indicates that the savings in database size are in the order of 30%. --- readyaml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'readyaml.py') diff --git a/readyaml.py b/readyaml.py index e2f3bb3..1a7206d 100755 --- a/readyaml.py +++ b/readyaml.py @@ -2,6 +2,7 @@ """This tool reads a yaml file as generated by importpkg.py on stdin and updates the database with the contents.""" +import binascii import sqlite3 import sys @@ -39,7 +40,7 @@ def readyaml(db, stream): (package, entry["name"], entry["size"])) cid = cur.lastrowid cur.executemany("INSERT INTO hash (cid, function, hash) VALUES (?, ?, ?);", - ((cid, func, hexhash) + ((cid, func, buffer(binascii.a2b_hex(hexhash))) for func, hexhash in entry["hashes"].items())) raise ValueError("missing commit block") -- cgit v1.2.3