From bcc3b5838b129b2af2f203ddd1b6f427902122d6 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 29 Sep 2009 15:01:34 +0200 Subject: [PATCH] Optimization => Faster by 20% Version:1.1.30 --- src/parsed_text.py | 11 ++++++----- src/version.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/parsed_text.py b/src/parsed_text.py index dea76ad..7100c17 100644 --- a/src/parsed_text.py +++ b/src/parsed_text.py @@ -33,19 +33,20 @@ from subroutines import subroutines import regexps import error +vtuple = map(lambda v: (v, variables[v], variables[v].same_as, variables[v].regexp), variables.keys()) + def find_variables_in_line(line): assert isinstance(line,Line) result = [] sub_done = False buffer = line.text.lower() - for v in variables.keys(): - var = variables[v] - if var.name in buffer: + for v,var,same_as,regexp in vtuple: + if v in buffer: if not sub_done: buffer = regexps.re_string.sub('',buffer) sub_done = True - if var.regexp.search(buffer) is not None: - result.append(var.same_as) + if regexp.search(buffer) is not None: + result.append(same_as) return result def find_subroutine_in_line(line): diff --git a/src/version.py b/src/version.py index 40ebca8..c02a9b9 100644 --- a/src/version.py +++ b/src/version.py @@ -1 +1 @@ -version = "1.1.29" +version = "1.1.30"