Informally, the algorithm constructs a search engine first and then uses it on raw text. In many cases, where the set of patterns is given in advance (e.g. computer virus database), the construction step could be performed only once and the compiled engine stored for later use.