Help optimize D solution to phone encoding problem: extremely slow performace.

Renato renato at athaydes.com
Thu Jan 18 16:23:16 UTC 2024


On Wednesday, 17 January 2024 at 16:54:00 UTC, H. S. Teoh wrote:
> On Wed, Jan 17, 2024 at 07:57:02AM -0800, H. S. Teoh via 
> Digitalmars-d-learn wrote: [...]
>> I'll push the code to github.
> [...]
>
> Here: 
> https://github.com/quickfur/prechelt/blob/master/encode_phone.d
>
>
> T

Ok, last time I'm running this for someone else :D

```
Proc,Run,Memory(bytes),Time(ms)
===> ./rust
./rust,23920640,30
./rust,24018944,147
./rust,24068096,592
./rust,24150016,1187
./rust,7766016,4972
./rust,8011776,46101
===> src/d/dencoder
src/d/dencoder,44154880,42
src/d/dencoder,51347456,87
src/d/dencoder,51380224,273
src/d/dencoder,51462144,441
src/d/dencoder,18644992,4414
src/d/dencoder,18710528,43548
```

Congratulations on beating Rust :D but remember: you're using a 
much more efficient algorithm! I must conclude that the Rust 
translation of the Trie algorithm would be much faster still, 
unfortunately (you may have noticed that I am on D's side here!).


More information about the Digitalmars-d-learn mailing list