Examples - Using Searchers

In this lesson you will see the results of various experiments done using searchers.

We'll cover the following

Performance Experiments

This example builds a performance test to exercise several ways of finding a pattern in a larger text.

Here’s how the test works:

  • The application loads a text file (configurable via a command-line argument), for example, a book sample (like a 500KB text file)
  • The whole file content is stored in one string - that will be “text” where we’ll be doing the lookups.
  • A pattern is selected - N letters from the input text. That way we can be sure the pattern can be found. The position of the string can be located at the front, centre or the end.
  • The benchmark uses several algorithms and runs each search ITER times.

Example benchmarks:

  • The std::string::find version:

Get hands-on with 1200+ tech skills courses.