Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: Best CPU for DF?  (Read 8840 times)

jecowa

  • Bay Watcher
    • View Profile
Re: Best CPU for DF?
« Reply #15 on: May 01, 2018, 10:41:21 pm »

Clock speed and single-threaded performance does not matter after a certain point since cache misses are the bottleneck. With that in mind, I think second gen Ryzen processors would probably be a good candidate for the best CPU for Dwarf Fortress since they have low cache latency.

Having lots of cache is helpful, but from what I understand, I don't think you can judge a CPU's cache capacity just from its listed spec. This is because not all of the listed L3 cache included with a CPU is going to be available to a single thread. Ryzen has 16 MB of L3 cache, but it's split into 2 groups of 8 MB. Half the cores share one 8 MB L3 cache and the other half share the other 8MB.
Logged

Larix

  • Bay Watcher
    • View Profile
Re: Best CPU for DF?
« Reply #16 on: May 02, 2018, 04:39:27 am »

I fired up one of the system management apps and as i remembered, that one has a "cache misses per second" parameter. Looked at two mildly cluttered forts (yes, that's totally unrepresentative):
first one - 84 FPS: cache misses/s typically ranged between 150 and 300, with rare spikes to 1000+. About 250 on average, i'd say
second one - 33 FPS: between 200 and 400 misses/s, spikes of just over 2000. Estimated average just above 300.

Naively, this looks to me like at this range, it's not cache misses that matter: assuming one cache miss costs 200ns, even 2000 in one second would amount to just 400µs, while the average even in the more-cluttered fort should sit comfortably below 100µs/s, i.e. less than 1% of 1% of operation time. I'd assume that purely cache-miss driven operation would be extreme lag spikes of under one FPS.

I'm almost certainly missing something fundamental, but i think it'd help if knowledgeable people tried to run some analytics on what influences FPS. I get the feeling we're still mostly dealing with assumptions that have little research behind them.

***
I've also looked at the parametrics on the old Core2Duo under Linux, and there, the manager shows a processor load of 100% on both cores, with no intensive process other than DF running. Curious...
Under Windows 10, with a 2C/4T processor, all threads show similar workloads, 25-40% mostly. The process gets moved between threads so often that load averages out over the measurement times. Thread switching is part of thermal management, i guess. The Core2 heats up from ~45 °C to ~75 when playing DF, and it's certainly better if it heats the cores evenly.
Logged

jecowa

  • Bay Watcher
    • View Profile
Re: Best CPU for DF?
« Reply #17 on: May 02, 2018, 11:22:10 am »

Previously someone tried over locking his CPU and got no performance boost. Then he tried overclocking his RAM and was able to increase the FPS (I think it went up from 10 to 12, but I haven't found the post yet.)

What app shows cache misses per second?

Edit: Here's one were he upgrades from i5-2400 (1203 cpu-z benchmark single thread) to i7-3770K (1910 cpu-z benchmark single thread) and got maybe a 11% FPS boost. Then he upgraded his RAM from 1600 MHz to 2400 MHz and got a 50% FPS boost. https://www.reddit.com/r/dwarffortress/comments/5kyyb5/faster_ram_gave_me_a_nice_fps_boost/
« Last Edit: May 02, 2018, 11:48:40 am by jecowa »
Logged

TV4Fun

  • Bay Watcher
    • View Profile
Re: Best CPU for DF?
« Reply #18 on: May 03, 2018, 06:23:14 pm »

Without detailed profiling data on how DF spends its time, it's difficult to speculate, but I suspect that in more cluttered fortresses, much of the game's time is spent on pathfinding, and is probably computation-bound. With that in mind, you want to find the highest single-threaded computations-per-second CPU you can get. Number of cores won't make a difference as DF is not multi-threaded. RAM speed may make some difference, but I doubt it's a deciding factor. Clock rate is an indicator of performance, but different CPUs will have different computation rates at the same clock speed. I don't think DF does much with floating point numbers, so integer performance is more important. Beyond that, the best way to determine performance would be by testing with different CPUs on the saved game. It's very hard to predict performance based on purely theoretical notions.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: Best CPU for DF?
« Reply #19 on: May 08, 2018, 09:04:50 am »

Ah, thanks. I searched the forums but I get so many results that are completely unrelated I can never find anything I am looking for.

How did you find those posts so easily? Are there search parameters I don't know about?
A bit late, but use Google! With "site:bay12forums.com", you'll only get results from the forum. I got all of the threads that Bumber linked plus several others on the first page with "site:bay12forums.com best cpu".

Usually this is a lot better than forum-specific searches, unless you want to use forum-specific filters like the ones found on http://www.bay12forums.com/smf/index.php?action=search.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Schmaven

  • Bay Watcher
  • Abiding
    • View Profile
Re: Best CPU for DF?
« Reply #20 on: May 08, 2018, 05:29:11 pm »

I just upgraded my i3-6100 3.7 GHz dual core to an i7-8700 3.7 GHz 6-core processor. 
In order to do that, I also upgraded my motherboard from an msi Z-170A Pro to an msi Z-370 SLI Plus.

Now I don't know exactly which part is responsible, but my FPS jumped up from around 37-45 to 65-75 on average with the same fort.  The important part for me is my Dwarves move about twice as fast now, so that's cool. 
Logged

jecowa

  • Bay Watcher
    • View Profile
Re: Best CPU for DF?
« Reply #21 on: May 10, 2018, 10:01:44 pm »

I wish someone would do some Dwarf Fortress test to compare these processors:
  • i7-8700K representing Coffee Lake
  • i7-5775C representing Broadwell
  • Ryzen 7 2700X representing Zen+

Disadvantage of the Broadwell is the DDR3, but it has that nice 128 MB L4 cache with the eDRAM.
Coffee Lake has the highest single-threaded performance, but Zen+ has the best cache latency.
Logged

Chief10

  • Bay Watcher
  • since 31
    • View Profile
Re: Best CPU for DF?
« Reply #22 on: May 11, 2018, 01:17:51 am »

I don't think DF does much with floating point numbers, so integer performance is more important.

Just curious what makes you say this?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Best CPU for DF?
« Reply #23 on: July 06, 2018, 06:15:40 am »

I don't think DF does much with floating point numbers, so integer performance is more important.

Just curious what makes you say this?

there aren't many floats in the raws and  from what i recall anything represented with divisors tend to have actual written out divisors-as-integers in the memory. temperature is a fixed point rather than a floating point (i.e. 32 bits for each side of the'decimal' [well, binary] place); in fact, looking through df-structures, it only uses floats in 1. graphics and 2. trigonometry, and the latter is all precalculated

Musaab

  • Bay Watcher
    • View Profile
Re: Best CPU for DF?
« Reply #24 on: July 06, 2018, 07:05:24 am »

my i7-7700k seems to be doing pretty well.

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: Best CPU for DF?
« Reply #25 on: July 06, 2018, 07:40:29 am »

I don't think DF does much with floating point numbers, so integer performance is more important.

Just curious what makes you say this?

there aren't many floats in the raws and  from what i recall anything represented with divisors tend to have actual written out divisors-as-integers in the memory. temperature is a fixed point rather than a floating point (i.e. 32 bits for each side of the'decimal' [well, binary] place); in fact, looking through df-structures, it only uses floats in 1. graphics and 2. trigonometry, and the latter is all precalculated


Even the physics uses fixed point math.
Logged

Devast

  • Bay Watcher
    • View Profile
Re: Best CPU for DF?
« Reply #26 on: July 06, 2018, 08:30:00 pm »

I love these threads even if they are often remade every 9 months. (maybe make a sticky?).
I wonder if having many dwarfs on a 2x2 would be comparable to few dwarfs on a 8x8.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Best CPU for DF?
« Reply #27 on: July 06, 2018, 10:45:28 pm »

I love these threads even if they are often remade every 9 months. (maybe make a sticky?).
I wonder if having many dwarfs on a 2x2 would be comparable to few dwarfs on a 8x8.

We can actually determine this with some simple math.

As the amount of dwarves go up, the complexity of pathfinding increases quadratically, and the same is true for fort extents:



However, in practice the effects are very unlikely to be equal, and I would guess that number of dwarves causes FPS death much more efficiently due to how few places the dwarves will actually path.

lethosor

  • Bay Watcher
    • View Profile
Re: Best CPU for DF?
« Reply #28 on: July 08, 2018, 11:46:53 am »

Did you come up with that yourself, or is the graphic from somewhere else? In particular, I find the dwarves^2 term hard to believe. Paths are usually computed only once per trip and then cached, and other units occupy relatively few map tiles, and they don't block each others' paths. Even if they do meet at the same time, some units simply lie down when that happens. At most, adding another unit requires computing an additional path for just that unit occasionally - it isn't slowed down by every other unit on the map.

Also, fort x/y/z dimensions are constant - I'm not sure why you dropped the z term. Paths are also influenced by tile properties indicating which groups of tiles are actually connected (see DFHack's "pathable" and "gui/pathable" tools), so they're restricted to much smaller sections of the map to begin with - DF knows almost instantly if a path can't be found between two locations.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

carewolf

  • Bay Watcher
    • View Profile
Re: Best CPU for DF?
« Reply #29 on: July 09, 2018, 12:11:41 pm »

What you need is fast memory. So look for CPUs that can do quad-channel memory and install four identical memory blocks on it. Or if you already have a machine, make sure you have the memory fully upgraded.
Logged
Pages: 1 [2] 3