Commit 05648d0
committed
stdlib: Use string:slice in flat_trunc for O(N) truncation
The latin1 list clause in flat_trunc/3 used lists:flatten + lists:split
which materializes the entire input (O(L)) just to take N chars.
Replace with string:slice/3 which is O(N), matching the existing
unicode clause. Also merge both list clauses into one since
string:slice handles both encodings.1 parent 53080e2 commit 05648d0
1 file changed
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1066 | 1066 | | |
1067 | 1067 | | |
1068 | 1068 | | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | 1069 | | |
1075 | 1070 | | |
1076 | | - | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
1077 | 1074 | | |
1078 | 1075 | | |
1079 | 1076 | | |
| |||
0 commit comments