Skip to content

Commit

Permalink
Performance: do not check for string in patter_parser (#56)
Browse files Browse the repository at this point in the history
We can trust that the input is a string. Checking for this is expensive.
The number of calls to is_str went down from 280000 calls to 22000 in most simple cases.

The test is also no more needed. If somebody gives a wrong input, it will just fail with an exception.
  • Loading branch information
iMichka committed Jul 5, 2016
1 parent 25bf2b2 commit 648e8da
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 69 deletions.
2 changes: 0 additions & 2 deletions pygccxml/declarations/pattern_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def __init__(

def has_pattern(self, decl_string):
"""implementation details"""
assert utils.is_str(decl_string)
last_part = decl_string.split('::')[-1]
return (
-1 != decl_string.find(self.__begin) and -
Expand All @@ -37,7 +36,6 @@ def has_pattern(self, decl_string):

def name(self, decl_string):
"""implementation details"""
assert utils.is_str(decl_string)
if not self.has_pattern(decl_string):
return decl_string
args_begin = decl_string.find(self.__begin)
Expand Down
14 changes: 0 additions & 14 deletions unittests/data/basic.hpp

This file was deleted.

51 changes: 0 additions & 51 deletions unittests/from_future_import_tester.py

This file was deleted.

2 changes: 0 additions & 2 deletions unittests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
import gccxml10185_tester
import inline_specifier_tester
import test_create_decl_string
import from_future_import_tester
import pep8_tester
import example_tester
import test_utils
Expand Down Expand Up @@ -128,7 +127,6 @@
gccxml10185_tester,
inline_specifier_tester,
test_create_decl_string,
from_future_import_tester,
example_tester,
test_utils,
test_va_list_tag_removal,
Expand Down

0 comments on commit 648e8da

Please sign in to comment.