diff options
author | Björn Gustavsson <[email protected]> | 2016-12-21 12:01:37 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-01-10 11:34:11 +0100 |
commit | 8fabcae494ae09bbcbd485501085c33a435adde5 (patch) | |
tree | c021ce5b23169c4f3d1383e7175f11cc7d1faccd | |
parent | af0ae0c83aa33ff437de346552b52709649622ef (diff) | |
download | otp-8fabcae494ae09bbcbd485501085c33a435adde5.tar.gz otp-8fabcae494ae09bbcbd485501085c33a435adde5.tar.bz2 otp-8fabcae494ae09bbcbd485501085c33a435adde5.zip |
Improve compilation speed for huge literal case expressions
Code with huge literal case expressions such as the following would
compile very slowly:
case "Very long literal string (thousands of characters)..." of
.
.
.
end.
The reason is that in the case optimization each character in the
string would be handled individually. Fix this bug by handling
literals all at once.
-rw-r--r-- | lib/compiler/src/sys_core_fold.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index 50d28c0a5f..3673a339f6 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -1893,10 +1893,10 @@ case_opt_arg_1(E0, Cs0, LitExpr) -> true -> E = case_opt_compiler_generated(E0), Cs = case_opt_nomatch(E, Cs0, LitExpr), - case cerl:data_type(E) of - {atomic,_} -> + case cerl:is_literal(E) of + true -> case_opt_lit(E, Cs); - _ -> + false -> case_opt_data(E, Cs) end end. |