!7 /* Task: Search a short string in 45 MB of source codes Results: simple contains() takes <10 ms when optimized (String.indexOf is a HotSpot-intrinsic) containsIC is really slow (700 ms) Boyer-Moore is 150 ms (case-insensitive) or 50 ms (case-sensitive) */ cprint { start-thread { SS map = dm_snippetIDToTextMap(); map = mapValues upper(cloneAsHashMap(map)); BoyerMooreStringSearch_upper search = new("Boyer"); print(totalStringLength(values(map))); LS result = null; repeat 10 { time "Search" { //result = keysWithValueThat(map, text -> containsIC(text, "Boyer")); result = keysWithValueThat(map, text -> contains(text, "BOYER")); //result = keysWithValueThat(map, text -> search.containedIn(text)); } } ret result; }