Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Dwarf Fortress is IIRC mainly limited by RAM latency. So you really should be trying to get 3600 MHz RAM with as tight timings (maybe CL16 timings?) as possible.

Dwarf Fortress's simulation is all about pointer-indirection and jumping around memory. The CPU doesn't really do much except wait for RAM most of the time. It takes ~50ns to talk to RAM, but the CPU is clocked at 4GHz (0.25 nanoseconds), giving you an idea of scale. The RAM tightening can bring your latency anywhere from 50ns to 200ns depending on how well you tune your RAM parameters, and depending on chips and stuff. (Servers usually have lots of slow LRDIMM RAM over multiple-sockets that can be 200ns latency or worse).

AMD takes their design out of the server-playbook, and seems to have ~100ns main DDR4 RAM Latency. So Dwarf Fortress probably will be faster on Intel i9-9900k (monolithic design with integrated memory controller and 50ns main memory latency).



Interesting! Is there a simple way to measure memory latency?


Create 1-billion 32-bit integers numbers between 0 to 1-billion. Knuth shuffle the integers.

"Linked list" traverse the integers as follows:

    //array is full of 1-billion numbers, randomly sorted
    uint32_t idx = 0;
    for(int i=0; i<200000000; i++){
        idx = array[idx]; // Random traversal
    }
Pull out a stopwatch (or use Linux's "time" functionality). Divide the time by 200000000. You've now measured memory latency.


I suggest using Sattolo’ algorithm instead.

Here is a relevant blog post https://lemire.me/blog/2018/11/13/memory-level-parallelism-i...


Awesome! Thanks for the write up and good info.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: