Improve performance of repeating strings (#3272)
This commit improves the performance of repeating strings, by copying the result string instead of the string being repeated. Also it adds an error message when the result string is too long.
This commit is contained in:
1 parent
5df471fa5b
commit
dc849e9bb7
4 files changed
+41
-13
No files matched your search
@@ -1460,6 +1460,18 @@ indices("o")
|
||||
"abc"
|
||||
[null,null]
|
||||
|
||||
. * 100000 | [.[:10],.[-10:]]
|
||||
"abc"
|
||||
["abcabcabca","cabcabcabc"]
|
||||
|
||||
. * 1000000000
|
||||
""
|
||||
""
|
||||
|
||||
try (. * 1000000000) catch .
|
||||
"abc"
|
||||
"Repeat string result too long"
|
||||
|
||||
[.[] / ","]
|
||||
["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"]
|
||||
[["a"," bc"," def"," ghij"," jklmn"," a","b"," c","d"," e","f"],["a","b","c","d"," e","f","g","h"]]
|
||||
|
||||
Reference in new issue
Block a user