00001 #!/usr/bin/python 00002 00003 # Copyright (C) 2009 Ferdinand Majerech 00004 # This file is part of IMGCrush 00005 # For conditions of distribution and use, see copyright notice in LICENSE.txt 00006 00007 import subprocess 00008 00009 #TODO: 0.5: A configurable benchmark (i.e. what jpg/png/gif levels to use, 00010 # how many benchmarks to do with these various settings - perhaps 00011 # load this from a file), also a scalability benchmark- 00012 # tests slowdown with various levels and with enlarging files 00013 00014 def benchmark(input): 00015 """Benchmarks imgcrush execution with given input. 00016 """ 00017 print "Benchmarking with input:", input 00018 subprocess.call("./benchmark_util '../imgcrush -jJ medium -pP medium" + 00019 " -gG medium -M q -Q 50 -o ./testdir \'" + input + "\''", 00020 shell=True) 00021 subprocess.call("rm -r ./testdir", shell=True) 00022 00023 def main(): 00024 inputs = ["many_files", "big_file.jpg"] 00025 for input in inputs: 00026 benchmark(input) 00027 00028 if __name__ == '__main__': 00029 main()