aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2018-05-14 15:06:29 +0200
committerDan Gudmundsson <[email protected]>2018-05-14 15:09:05 +0200
commit5c51e87bee9d8db0503f41eda4ab0589df1a2ec1 (patch)
tree828f129be32eb359506a41b48ca34a6f8513e494 /lib/stdlib/test
parentb873e5cd6d78191d303c7c828ab7df7cd7fdf4d2 (diff)
downloadotp-5c51e87bee9d8db0503f41eda4ab0589df1a2ec1.tar.gz
otp-5c51e87bee9d8db0503f41eda4ab0589df1a2ec1.tar.bz2
otp-5c51e87bee9d8db0503f41eda4ab0589df1a2ec1.zip
Optimize string lowercase, uppercase and casefold for ASCII characters
Diffstat (limited to 'lib/stdlib/test')
-rw-r--r--lib/stdlib/test/string_SUITE.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/stdlib/test/string_SUITE.erl b/lib/stdlib/test/string_SUITE.erl
index fdff2d24b8..29fabb4583 100644
--- a/lib/stdlib/test/string_SUITE.erl
+++ b/lib/stdlib/test/string_SUITE.erl
@@ -810,6 +810,18 @@ do_measure(DataDir) ->
Do2(slice, repeat(fun() -> string:slice(S0, 20, 15) end), list),
Do2(slice, repeat(fun() -> string:slice(S0B, 20, 15) end), binary),
+ LCase = "areaa reare rerar earea reare reare",
+ LCaseB = unicode:characters_to_binary(LCase),
+ UCase = string:uppercase(LCase),
+ UCaseB = unicode:characters_to_binary(UCase),
+
+ Do2(to_upper_0, repeat(fun() -> string:to_upper(UCase) end), list),
+ Do2(uppercase_0, repeat(fun() -> string:uppercase(UCase) end), list),
+ Do2(uppercase_0, repeat(fun() -> string:uppercase(UCaseB) end), binary),
+ Do2(to_upper_a, repeat(fun() -> string:to_upper(LCase) end), list),
+ Do2(uppercase_a, repeat(fun() -> string:uppercase(LCase) end), list),
+ Do2(uppercase_a, repeat(fun() -> string:uppercase(LCaseB) end), binary),
+
io:format("--~n",[]),
NthTokens = {nth_lexemes, fun(Str) -> string:nth_lexeme(Str, 18000, [$\n,$\r]) end},
[Do(Name,Fun,Mode) || {Name,Fun} <- [NthTokens], Mode <- [list, binary]],