improve strcat, strsubst, part performance 31/21431/5
authorAntoine ELIAS <antoine.elias@esi-group.com>
Thu, 5 Mar 2020 08:45:13 +0000 (09:45 +0100)
committerClement DAVID <clement.david@esi-group.com>
Tue, 10 Mar 2020 09:33:51 +0000 (10:33 +0100)
commit5c5f20c776e4d8dbc833fbcd3851e115f008938f
tree92b4edca1af97dcce97f7f3235e760ec0c115eb4
parent54d399b6bbf065082b29db8fdbe573c85b636249
improve strcat, strsubst, part performance

//strcat
a = ones(1,300000);
b = string(a);
tic();strcat(b);toc()

//strsubst
A = string(rand(100, 100));
tic;B = strcat(A);toc
tic;strsubst(B, "3", "X");toc
tic;strsubst(B, "30", "X");toc
tic;strsubst(B, "3", "XYZ");toc

//part
c = 1e5;
str = strcat(string(int(rand(1, c) * 10)));
idx = int(rand(1, c) * c + 1);
tic;part(str, idx);toc

Change-Id: I8f2635cf3ce2e3ab257690935ddf0961b403ea40
scilab/CHANGES.md
scilab/modules/string/sci_gateway/cpp/sci_part.cpp
scilab/modules/string/sci_gateway/cpp/sci_strcat.cpp
scilab/modules/string/sci_gateway/cpp/sci_strsubst.cpp
scilab/modules/string/tests/benchmarks/bench_part2.tst [new file with mode: 0644]