| Author | Dave Jarvis <email> |
|---|---|
| Date | 2022-11-01 08:47:55 GMT-0700 |
| Commit | 0eb76172bc9e7aa94b1f7bd949984c4c915ea0a3 |
| Parent | b6cb81a |
| import static java.text.CharacterIterator.DONE; | ||
| +/** | ||
| + * Higher scores mean faster code: | ||
| + * | ||
| + * <pre> | ||
| + * Benchmark Mode Cnt Score Error Units | ||
| + * test_CharArrayIterator thrpt 25 753.960 ± 0.972 ops/s | ||
| + * test_CharAtIterator thrpt 25 878.016 ± 0.884 ops/s | ||
| + * test_FastCharacterIterator thrpt 25 803.041 ± 48.422 ops/s | ||
| + * test_StreamIterator thrpt 25 101.416 ± 0.053 ops/s | ||
| + * test_StringCharacterIterator thrpt 25 580.341 ± 0.432 ops/s | ||
| + * test_StringTokenizer thrpt 25 174.121 ± 8.282 ops/s | ||
| + * </pre> | ||
| + */ | ||
| @SuppressWarnings( "unused" ) | ||
| public class StringIterationBenchmark { |
| import java.text.CharacterIterator; | ||
| -import java.text.StringCharacterIterator; | ||
| import java.util.function.Function; | ||
| import static java.text.CharacterIterator.DONE; | ||
| /** | ||
| * Iterates over a string, much like {@link CharacterIterator}, but faster. | ||
| - * Achieves 1128.230 ops/s vs. 49 ops/s for {@link StringCharacterIterator}. | ||
| * <p> | ||
| * <strong>Caution:</strong> This class offers minimal bounds checking to eke |
| Delta | 13 lines added, 2 lines removed, 11-line increase |
|---|