4 ms·
D uses slices for strings, which also gives D a big performance boost over C whenever strings are in play.
by WalterBright 6y ago
D uses slices for strings, which also gives D a big performance boost over C whenever strings are in play.
- BruceEel 6y agoWalter, can you elaborate on this, are D's slices functionally equivalent to C++'s string_view? I.e. no copying as long no 'ASCIIZ-dependent' code is involved?
- WalterBright 6y agoD strings are a simply a pointer/length pair. Substrings can be extracted with no alloc/copying necessary. The length can be determined without loading the string into the cache and scanning it. Those two features make for big speed improvements.