Fastest Prime Sieve, in D

Exil Exil at gmall.com
Sat Jun 29 15:39:03 UTC 2019


On Saturday, 29 June 2019 at 12:28:35 UTC, Jabari Zakiya wrote:
> Timing comparisons on my system. Nim code compiled with GCC 
> 8.3.1 (system has LLVM 8.0.0).
>
> ```
>             N          |       Nim       |       D       | 
> Ratio |
>     
> -------------------|-----------------|---------------|-------|
>        100_000_000_000 |       4.628     |      4.619    |  
> 1.00 |
>        500_000_000_000 |      23.308     |     24.071    |  
> 1.03 |
>      1_000_000_000_000 |      47.966     |     49.703    |  
> 1.04 |
>      5_000_000_000_000 |     265.746     |    276.847    |  
> 1.04 |
>     10_000_000_000_000 |     572.803     |    590.881    |  
> 1.03 |
>     50_000_000_000_000 |    3009.485     |   3046.913    |  
> 1.01 |
>    100_000_000_000_000 |    6307.521     |   6594.283    |  
> 1.04 |
>    200_000_000_000_000 |   13603.531     |  14706.743    |  
> 1.08 |
> ```

Could be the difference between NIM's GC and D's, seeing as you 
are continually allocating new arrays. Could just be that the GCC 
backend for NIM generates better assembly than LLVM. Could 
profile the two and look at the assembly to see where the 
additional time is being spent.


More information about the Digitalmars-d mailing list