Bay 12 Games Forum

Please login or register.

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

Author Topic: Just a little bit of cpu optimization? pretty please?  (Read 9618 times)

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #15 on: November 26, 2008, 01:37:22 pm »

Can anyone else running on dual core provide feedback?  Have you seen this happening?  I'm 99% sure this doesn't happen on single core systems.
Logged

Granite26

  • Bay Watcher
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #16 on: November 26, 2008, 02:18:51 pm »


 (there are plenty that use an entire core or the whole CPU at a stretch, but only while they're actually doing something)


I'd guess that they are either smaller programs, or designed by a team of programmers, or built on a platform dependant design tool that does a lot of that for you.  I wouldn't want to try to do have of what DF does and still try to manage OS concerns...

Nullvoid01

  • Escaped Lunatic
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #17 on: November 26, 2008, 02:26:02 pm »

My core usage history on the main screen. Dwarf fortress are set to use core1 (the one on the right)

It is like this when paused (but still viewing the map) and on the Esc menu.
Logged

Random832

  • Bay Watcher
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #18 on: November 26, 2008, 03:29:50 pm »

So either setting affinity will work (still shouldn't be necessary, but w/e) or I'm stuck in some bizarre horrible corner case that's going to melt my CPU and drain my battery.
Logged

Tormy

  • Bay Watcher
  • I shall not pass?
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #19 on: November 26, 2008, 04:10:50 pm »

When I pause the game or hit "ESC" to display the main menu, DF's CPU usage @ a specific core goes down to the same level. [~10-12%]
« Last Edit: November 26, 2008, 04:12:27 pm by Tormy »
Logged

Jay

  • Bay Watcher
  • ☼Not Dead Yet☼
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #20 on: November 26, 2008, 07:57:42 pm »

Well, you know, you haven't told us anything about the processor in question. (Other than dual-cored-ness)
Since you're the only one who's had this problem as far as we've seen, you're not helping.
Logged
Mishimanriz: Histories of Pegasi and Dictionaries

numerobis

  • Bay Watcher
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #21 on: November 26, 2008, 08:37:17 pm »

No one has mentioned to try PARTIAL_PRINT, which you set in the init.txt

The program runs a tight little display loop at 100 FPS or whatever you set G_FPS to (100 on mac, you have no choice).  PARTIAL_PRINT says not to redisplay everything everytime.  Unfortunately, it's a bit buggy right now, so it may totally fall flat on its face for you, but if it works, it drastically reduces the redraw overhead.
Logged

Idiom

  • Bay Watcher
  • [NO_THOUGHT]
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #22 on: November 27, 2008, 12:12:47 am »

Quote
I want it to use less CPU. I can get 99FPS, I want to use a third of that much CPU to get 33FPS.
Ctrl-Alt-Del, Processes, right-click, set priority, low?
Logged

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: Just a little bit of cpu optimization? pretty please?
« Reply #23 on: November 27, 2008, 12:48:13 am »

I am afraid it is too late for DF to ever support modern CPU's. Toady has stated explicitly that he does not know how to multi-thread and he will not accept help. Every feature that is added to DF makes a future shift to multi-threading geometrically harder. By the time toady gets to the point where he would consider it, it will be to late and it would take a complete rewrite to get it to use multiple cores and also be stable.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Random832

  • Bay Watcher
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #24 on: November 27, 2008, 02:02:55 am »

Setting affinity to a single core worked.
Logged

Granite26

  • Bay Watcher
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #25 on: November 27, 2008, 08:41:51 am »

I am afraid it is too late for DF to ever support modern CPU's. Toady has stated explicitly that he does not know how to multi-thread and he will not accept help. Every feature that is added to DF makes a future shift to multi-threading geometrically harder. By the time toady gets to the point where he would consider it, it will be to late and it would take a complete rewrite to get it to use multiple cores and also be stable.

I think you are overstating the difficulty of the coding...

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #26 on: November 27, 2008, 09:22:14 am »

I am afraid it is too late for DF to ever support modern CPU's. Toady has stated explicitly that he does not know how to multi-thread and he will not accept help. Every feature that is added to DF makes a future shift to multi-threading geometrically harder. By the time toady gets to the point where he would consider it, it will be to late and it would take a complete rewrite to get it to use multiple cores and also be stable.

I think you are overstating the difficulty of the coding...

I don't think so, if multiprocessor coding was simple, many games would use it,  as it stands there are currently only two or three games which really use multiprocessors at all, and they break only into 4 work threads to do it with that are very unbalanced.  (I am speaking of supreme commander and Supreme commander forged alliance of course) There was one other one I think that used a multicore processor to its fullest as well but I cant remember its name.

Many games run better of course with a Multicore setup but its mostly because one core handles the antivirus engine and windows crap while the other core plays the game.


Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.

Rotinaj

  • Bay Watcher
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #27 on: November 27, 2008, 09:47:34 am »

Couldn't you just cap your fps lower?
Logged

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: Just a little bit of cpu optimization? pretty please?
« Reply #28 on: November 27, 2008, 10:49:20 am »

I am afraid it is too late for DF to ever support modern CPU's. Toady has stated explicitly that he does not know how to multi-thread and he will not accept help. Every feature that is added to DF makes a future shift to multi-threading geometrically harder. By the time toady gets to the point where he would consider it, it will be to late and it would take a complete rewrite to get it to use multiple cores and also be stable.

I think you are overstating the difficulty of the coding...

You might be right if I said it was exponentially harder, but I didn't. Making multi-threaded apps is easy. All you have to do is split your workload into seperate threads. This works great, until the different threads have to communicate with each other or access the same object. Then you have to synchronize (only where you need to, because it causes a lot of overhead) and then you have to avoid deadlocks, race conditions, CPU starvation, etc. Each of these issues are very difficult to debug, they are intermittent, can not be watched by simply stepping through the debugger, and can be prevented, caused, revealed or hidden by something as simple as a write line being put in to watch a variable (IO requires a context switch and some wait time, that can change thread scheduling or delay the process just enough for the lock to resolve or one of the actors to break).

This is what I do for a living (performance critical custom applications, not games), and I am pretty good at it. If a system isn't designed and built with multi-threading in mind, all these difficult issues are made that much more painful when it comes time to do the dirty work. While Toady has perhaps the best planning and documentation I have ever seen in a single developer project, I don't think its enough.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Draco18s

  • Bay Watcher
    • View Profile
Re: Just a little bit of cpu optimization? pretty please?
« Reply #29 on: November 27, 2008, 12:50:07 pm »

Until your pathfinding thread lags down because all of a sudden there are a lot of unwalkable tiles that many dwarves were attempting to use because you started a magma flood.

Of course, the flows thread is running at normal speed.

Welcome to "none of my dwarves moved while magma gushed with rapid pace through my dining room."
Logged
Pages: 1 [2] 3 4 ... 6