Commit Graph

17 Commits

Author SHA1 Message Date
Thomas Jarosch 62b05193c4 MC: Split convertFile() function into smaller pieces
Output of build/ stayed the same.
2012-12-31 15:30:27 +01:00
Thomas Jarosch 311630ac1c Match compiler: Python syntax simplification
Output in build/ stayed the same
2012-12-31 15:03:00 +01:00
Thomas Jarosch 51cff0cb9b Match compiler: Speed up Token comparison with string literals. Ticket #4451
"Cache" string literals as C++ std::string objects.
The string length gets cached and so we don't need to
call strlen() on the literals at runtime.
2012-12-31 14:45:16 +01:00
Thomas Jarosch 3c915b534d Match compiler: Collect and cache plain C-strings
Profiler runs with gperftools showed we were spending
a lot of time in strlen() even with compiled match patterns.

If you compare a std::string with a plain C-string,
the comparison operator needs to calculate the length
of the C-string via strlen().

We can avoid this by turning all C-strings into C++ strings,
which cache the string length internally.

The match compiler has been adapted to collect all
C-strings during compilation and aggregate them.

Benchmark on the 'rpm' code base on a Core i7 920 box:

cppcheck without matchcompiler:
real    0m30.977s

cppcheck with previous matchcompiler:
real    0m28.157s

cppcheck with cached C-strings:
real    0m17.823s
2012-12-30 23:24:28 +01:00
Thomas Jarosch fe5ee76165 Match compiler: No need to handle %num% twice 2012-12-30 20:33:49 +01:00
Thomas Jarosch 3d0b4a9f7e Add execute permissions to matchcompiler.py on linux 2012-12-25 13:18:24 +01:00
Thomas Jarosch a2885a1759 Python 3 compatibility for the helper scripts
print() is a function in python 3.
Works with pyhton 2.x, too.
2012-12-25 13:12:58 +01:00
Daniel Marjamäki 3b3fe1c616 matchcompiler: throw InternalError if Token::Match is called with the varid 0 2012-12-19 06:45:05 +01:00
Daniel Marjamäki b6786c87b4 matchcompiler: handle %varid% 2012-12-14 16:59:37 +01:00
Daniel Marjamäki 2d8ed65d43 compiled Token::Match patterns: refactorings,improvements 2012-12-10 20:28:11 +01:00
Daniel Marjamäki a11ec4a5ee matchcompiler: replaced regular expression with simple code that parses the code better 2012-12-08 19:29:16 +01:00
Daniel Marjamäki 9fcfb38a1c matchcompiler: merged regular expressions to a single expression 2012-12-08 16:22:55 +01:00
Daniel Marjamäki bef0cf149b matchcompiler: reverted changes so the 'make test' works again 2012-12-08 07:41:18 +01:00
Daniel Marjamäki 9bd222970e matchcompiler: fixed hang. don't know why it hangs. 2012-12-04 23:38:49 +01:00
Daniel Marjamäki ae7846bf7e matchcompiler: added some selftests for findMatchPattern 2012-12-04 22:57:52 +01:00
Daniel Marjamäki ef5eece286 Compiled Token::Match patterns: extended match patterns and refactored the script a little 2012-12-02 13:39:59 +01:00
Daniel Marjamäki d630d34b62 Compiled Token::Match patterns. Added python script solution. Python is required to build with compiled patterns. To build cppcheck with compiled patterns use 'make LIBDIR=build'. 2012-12-02 12:36:55 +01:00