mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 21:51:40 +03:00
Merge pull request #6606 from wilzbach/merge_stable
Merge remote-tracking branch 'upstream/stable' into merge_stable merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
This commit is contained in:
commit
fcc98f8170
2 changed files with 29 additions and 3 deletions
19
changelog/std-algorithm-iteration-joiner.dd
Normal file
19
changelog/std-algorithm-iteration-joiner.dd
Normal file
|
@ -0,0 +1,19 @@
|
|||
The performance of `std.algorithm.iteration.joiner` has been improved
|
||||
|
||||
$(H4 DMD)
|
||||
|
||||
$(CONSOLE
|
||||
> dmd -O -inline -release ./joiner.d && ./joiner
|
||||
before.joiner = 57 secs, 834 ms, 289 μs, and 3 hnsecs
|
||||
new.joiner = 44 secs, 936 ms, 706 μs, and 5 hnsecs
|
||||
)
|
||||
|
||||
$(H4 LDC)
|
||||
|
||||
$(CONSOLE
|
||||
> ldmd -O3 -release -inline joiner.d && ./joiner
|
||||
before.joiner = 5 secs, 180 ms, 193 μs, and 7 hnsecs
|
||||
new.joiner = 3 secs, 168 ms, 560 μs, and 6 hnsecs
|
||||
)
|
||||
|
||||
The benchmark code can be found $(LINK2 https://gist.github.com/wilzbach/ffd5d20639766a831fd4b1962572897a, here).
|
13
std/uni.d
13
std/uni.d
|
@ -9003,16 +9003,18 @@ if (isSomeString!S || (isRandomAccessRange!S && hasLength!S && hasSlicing!S && i
|
|||
{
|
||||
import std.array : appender, array;
|
||||
import std.ascii : isASCII;
|
||||
import std.utf : byDchar;
|
||||
import std.utf : byDchar, codeLength;
|
||||
|
||||
alias C = ElementEncodingType!S;
|
||||
|
||||
auto r = s.byDchar;
|
||||
for (size_t i; !r.empty; ++i, r.popFront())
|
||||
for (size_t i; !r.empty; i += r.front.codeLength!C , r.popFront())
|
||||
{
|
||||
auto cOuter = r.front;
|
||||
ushort idx = indexFn(cOuter);
|
||||
if (idx == ushort.max)
|
||||
continue;
|
||||
auto result = appender!(ElementEncodingType!S[])();
|
||||
auto result = appender!(C[])();
|
||||
result.reserve(s.length);
|
||||
result.put(s[0 .. i]);
|
||||
foreach (dchar c; s[i .. $].byDchar)
|
||||
|
@ -9062,6 +9064,11 @@ if (isSomeString!S || (isRandomAccessRange!S && hasLength!S && hasSlicing!S && i
|
|||
assert(s == "abcdefghij");
|
||||
}
|
||||
|
||||
@safe unittest // 18993
|
||||
{
|
||||
static assert(`몬스터/A`.toLower.length == `몬스터/a`.toLower.length);
|
||||
}
|
||||
|
||||
|
||||
// generic toUpper/toLower on whole range, returns range
|
||||
private auto toCaser(alias indexFn, uint maxIdx, alias tableFn, alias asciiConvert, Range)(Range str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue