From: Behdad Esfahbod Date: Tue, 8 May 2012 17:38:49 +0000 (+0200) Subject: Make hb-diff faster X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d22135b4c3f8fb70552302bf8239df9976dddda;p=platform%2Fupstream%2FlibHarfBuzzSharp.git Make hb-diff faster --- diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py index 94207f8..d85c38e 100644 --- a/test/shaping/hb_test_tools.py +++ b/test/shaping/hb_test_tools.py @@ -1,6 +1,7 @@ #!/usr/bin/python import sys, os, re, difflib, unicodedata, errno +from itertools import * class Colors: class Null: @@ -91,7 +92,7 @@ class FancyDiffer: @staticmethod def diff_files (f1, f2, colors=Colors.Null): try: - for (l1,l2) in zip (f1, f2): + for (l1,l2) in izip (f1, f2): if l1 == l2: sys.stdout.writelines ([" ", l1]) continue @@ -100,7 +101,7 @@ class FancyDiffer: # print out residues for l in f1: sys.stdout.writelines (["-", colors.red, l, colors.end]) - for l in f1: + for l in f2: sys.stdout.writelines (["-", colors.green, l, colors.end]) except IOError as e: if e.errno != errno.EPIPE: @@ -114,6 +115,7 @@ class DiffFilters: def filter_failures (f): for l in f: if l[0] in '-+': + # TODO retain all lines of the failure yield l