source: docs/Working/icGrep/evaluation.tex @ 4472

Last change on this file since 4472 was 4472, checked in by nmedfort, 5 years ago

General clean up and to-UTF8

File size: 5.0 KB
Line 
1\section{Evaluation}\label{sec:evaluation}
2
3In this section, we report on the evaluation of ICgrep performance, looking
4at three aspects.   First we consider a performance studies in a series
5of Unicode regular expression search problems in comparison to the
6contemporary competitors, including pcre2grep released in January 2015
7and ugrep of the ICU 54.1 software distribution.  Then we move on to
8investigate some performance aspects of ICgrep internal methods, looking
9at the impact of optimizations and multithreading.
10
11\subsection{ICgrep vs. Contemporary Competitors}
12
13A key feature of Unicode level 1 support in regular expression engines
14is how the support that they provide for property expressions and combinations of property expressions
15using set union, intersection and difference operators.   Both {\tt ugrep}
16and {\tt icgrep} provide systematic support for all property expressions
17at Unicode Level 1 as well as set union, intersection and difference.
18On the other hand, {\tt pcre2grep} does not support the set intersection and difference operators directly.
19However, these operators can instead be expressed using a regular expression
20feature known as a lookbehind assertion.   Set intersection involves a
21regular expression formed with a one of the property expressions and a
22positive lookbehind assertion on the other, while set difference uses
23a negative lookbehind assertion.  As all three programs support lookbehind
24assertions in this way, we systematically generated set intersection and
25difference in this way.
26
27We generated a set of regular expressions involving all Unicode values of
28the Unicode general
29category property ({\tt gc}) and all values of the Unicode script property ({\tt sc}).  We then generated
30expressions involving random pairs of {\tt gc} and {\tt sc}
31values combined with a random set operator chosen from union, intersection and difference.
32All property values are represented at least once.   A small number of
33expressions were removed because they involved properties not supported by pcre2grep.
34In the end 246 test expressions were constructed in this process.
35
36We selected a set of Wikimedia XML files in several major languages representing
37most of the world's major language families as a test corpus.   For each program
38under test, we perform searches for each regular expression against each XML document.
39Searches were repeated n times.  Table \ref{tbl:property_test} shows the results.
40
41\begin{table}
42\input{table-prop.tex}
43\caption{Performance of Matching Property and Property Combinations}\label{tbl:property_test}
44\end{table}
45
46
47
48\subsection{Optimizations of Bitwise Methods}
49
50In order to support evaluation of bitwise methods, as well as to support
51the teaching of those methods and ongoing research, \icGrep{} has an array
52of command-line options.   This makes it relatively straightforward
53to report on certain performance aspects of ICgrep, while others require
54special builds. 
55
56For example, the command-line switch {\tt -disable-matchstar} can be used
57to eliminate the use of the MatchStar operation for handling
58Kleene-* repetition of character classes.   In this case, \icGrep{} substitutes
59a while loop that iteratively extends match results.   
60Surprisingly, this
61does not change performance much in many practical cases.   
62In each block,
63the maximum iteration count is the maximum length run encountered; the
64overall performance is based on the average of these maximums throughout the
65file.   But when search for XML tags using the regular expression
66\verb:<[^!?][^>]*>:, a slowdown of more than 2X may be found in files
67with many long tags. 
68
69The {\tt -disable-log2-bounded-repetition} flag allows these
70effectiveness of the special techniques for bounded repetition of
71byte classes to be assessed.   A slowdown of 30\% was observed
72with the searches using the regular expression
73\verb:(^|[ ])[a-zA-Z]{11,33}([.!? ]|$):, for example.
74
75To assess the effectiveness of inserting if-statements, the
76number of non-nullable pattern elements between the if-tests
77can be set with the {\tt -if-insertion-gap=} option.   The
78default value in \icGrep{} is 3, setting the gap to 100 effectively
79turns of if-insertion.   Eliminating if-insertion sometimes improves
80performance by avoiding the extra if tests and branch mispredications.
81For patterns with long strings, however, there can be a substantial
82slowdown; searching for a pattern of length 40 slows down by more
83than 50\% without the if-statement short-circuiting.
84
85ICgrep also provides options that allow
86various internal representations to be printed out.   These
87can aid in understanding and/or debugging performance issues.
88For example, the option
89{\tt -print-REs} show the parsed regular expression as it goes
90through various transformations.   The internal Pablo code generated
91may be displayed with {\tt -print-pablo}.  This can be quite useful in
92helping understand the match process.   It also possible to print out the
93generated LLVM IR code ({\tt -dump-generated-IR}), but this may be
94less useful as it includes many
95details of low-level carry-handling that obscures the core logic.
96
97\subsection{Single vs. Multithreaded Performance}
Note: See TracBrowser for help on using the repository browser.