Java indexOf function more efficient than Rabin-Karp? Search Efficiency of Text

后端 未结 7 521
面向向阳花
面向向阳花 2020-12-20 11:47

I posed a question to Stackoverflow a few weeks ago about a creating an efficient algorithm to search for a pattern in a large chunk of text. Right now I am using the St

7条回答
  •  一向
    一向 (楼主)
    2020-12-20 12:26

    Without looking into details, two reasons come to my mind:

    • you are very likely to outperform standard API implementations only for very special cases. I do not consider "Mary had a little lamb whose fleece was white as snow" to be such.
    • microbenchmarking is very difficult and can give quite misleading results. Here is an explanation, here a list of tools you could use

提交回复
热议问题