Dwarf Fortress Bug Tracker - Dwarf Fortress
View Issue Details
0010052Dwarf FortressTechnical -- Generalpublic2016-10-26 13:082018-02-23 15:52
alexchandel 
lethosor 
normalminoralways
acknowledgedopen 
OS X10.12.0
0.43.05 
 
0010052: DF uses 57% in PRINT_MODE:2D with 640x300 window, over 100% when maximized
Running the current version of dwarf-fortress on the current version of macOS/OSX with the default settings results in a steady 57% usage. Maximizing the window results in over 100% usage.

This persists even when a world is loaded & paused, and even with sound disabled. Based on the description of 2D print mode, there's no reason this abhorrent CPU usage should exist.

This is severe because without 2D print mode on OSX, the crash from 0009762 occurs. It's possible both issues are related, and emanate from the ancient version of SDL that DF uses.
1. Start DF 0.43.05 on macOS 10.12.0
2. Observe 57% CPU usage on the menu and in-game.
No tags attached.
has duplicate 0011152resolved lethosor Input lags on fullscreen 
related to 0011680confirmed lethosor Game window is blank on macOS 11 
Issue History
2016-10-26 13:08alexchandelNew Issue
2016-10-26 13:40alexchandelNote Added: 0036003
2016-11-24 22:52lethosorNote Added: 0036062
2016-11-24 22:52lethosorAssigned To => lethosor
2016-11-24 22:52lethosorStatusnew => needs feedback
2017-04-25 15:00alexchandelNote Added: 0036465
2017-04-25 15:00alexchandelStatusneeds feedback => assigned
2017-04-25 15:19alexchandelNote Added: 0036466
2017-04-29 11:50lethosorNote Added: 0036477
2017-04-29 11:50lethosorStatusassigned => needs feedback
2017-04-29 11:50lethosorNote Edited: 0036477bug_revision_view_page.php?bugnote_id=0036477#r14710
2017-04-29 11:53lethosorDescription Updatedbug_revision_view_page.php?rev_id=14712#r14712
2017-05-12 10:04alexchandelNote Added: 0036526
2017-05-12 10:04alexchandelStatusneeds feedback => assigned
2017-05-12 10:05alexchandelNote Edited: 0036526bug_revision_view_page.php?bugnote_id=0036526#r14728
2017-05-12 10:05alexchandelNote Edited: 0036466bug_revision_view_page.php?bugnote_id=0036466#r14730
2017-05-12 10:05alexchandelNote Edited: 0036466bug_revision_view_page.php?bugnote_id=0036466#r14731
2017-05-17 14:07lethosorNote Added: 0036535
2017-05-17 14:07lethosorStatusassigned => acknowledged
2017-12-16 20:35alexchandelNote Added: 0037336
2018-02-16 11:39alexchandelNote Added: 0037797
2018-02-16 11:39alexchandelNote Edited: 0037336bug_revision_view_page.php?bugnote_id=0037336#r15364
2018-02-16 14:42lethosorNote Added: 0037798
2018-02-23 15:52jecowaNote Added: 0037825
2018-02-23 15:52jecowaNote Edited: 0037825bug_revision_view_page.php?bugnote_id=0037825#r15380
2019-10-05 13:55lethosorRelationship addedhas duplicate 0011152
2021-01-28 17:06lethosorRelationship addedrelated to 0011680

Notes
(0036003)
alexchandel   
2016-10-26 13:40   
Note that 2D is the only mode that uses 57-100% CPU, and changing to SINGLE_BUFFER:YES makes no difference.
(0036062)
lethosor   
2016-11-24 22:52   
Are you using the 64-bit build (which comes with SDL 1.2.15) or the 32-bit build (SDL 1.2.13, last I checked)?

This is almost certainly an SDL 1.2 issue Toady can't fix, in any case.
(0036465)
alexchandel   
2017-04-25 15:00   
The 64-bit build, version 0.43.05 for OS X, which comes with SDL 1.2.14 according to its Info.plist, but SDL 1.2.15 according to its SDL_version.h.

This can't be a wholly SDL issue, as there are plenty of SDL 1.2.x games that don't use 100% CPU when maximized.
(0036466)
alexchandel   
2017-04-25 15:19   
(edited on: 2017-05-12 10:05)
I switched to PRINT_MODE:TEXT for now, which works fantastic. (when using "bright colors for bold text" per 0010054. I didn't realize DF used ANSI 8-colors with bold rather than 256-colors in text mode.)

Has Toady ever attempted updating to SDL 2? I know the video functions have changed somewhat, but given that so much of DF code is mechanics and so little video, shouldn't the upgrade be relatively manageable? As long as PRINT_MODE:TEXT still exists afterwards.

(0036477)
lethosor   
2017-04-29 11:50   
The fact that this doesn't occur on OS X 10.11 implies to me that it's a compatibility issue with SDL 1.2 and macOS 10.12. SDL 1.2 is ancient, so I wouldn't expect it to work well on on newer macOS versions.

Does PRINT_MODE:STANDARD work? That's typically been better in terms of performance for me.

Also, the SDL version in SDL_version.h (1.2.15) is the right one.

(0036526)
alexchandel   
2017-05-12 10:04   
(edited on: 2017-05-12 10:05)
PRINT_MODE:STANDARD and other OpenGL modes do work.

It would be nice if 2D modes worked though, since OpenGL modes don't support truetype fonts.

Interestingly the new SDL build from 0009762 doesn't fix this issue. Is there an open bug for updating to SDL 2?

(0036535)
lethosor   
2017-05-17 14:07   
There is not, but not using SDL 2 is not a bug by itself, so please don't report it here.

Toady wasn't the person that wrote the SDL code, by the way, so it wouldn't be easy for him to update.
(0037336)
alexchandel   
2017-12-16 20:35   
(edited on: 2018-02-16 11:39)
Just tested, still happens in 44.02 and macOS 10.13 (even with Mifki's SDL build).

(0037797)
alexchandel   
2018-02-16 11:39   
Interestingly, this doesn't happen with TWBT (v0.44.05, Mifki's SDL build).
(0037798)
lethosor   
2018-02-16 14:42   
That's because TWBT is PRINT_MODE:STANDARD (TWBT in init.txt, but DF defaults that to STANDARD).
(0037825)
jecowa   
2018-02-23 15:52   
Just did some testing of this on 2013 desktop computer with 64-bit 0.44.05 on Mac OS X 10.12 Sierra.

Default Window size, 2D Print: 16.1% - 16.9% CPU usage
Default Window size, STANDARD Print: 7.6% - 8.0% CPU usage


Maximized Window size (not full screen), 2D Print: 27.4% - 27.9% CPU usage
Maximized Window size (not full screen), STANDARD Print: 81.0% - 81.2% CPU usage


And for comparison, some testing on 2008 laptop computer with 64-bit 0.44.05 on Mac OS X 10.7 Lion:

Default Window size, 2D Print: 15.4% - 16.3% CPU usage
Default Window size, STANDARD Print: 12.0% - 13.4% CPU usage


Maximized Window size (not full screen), 2D Print: 53.2% - 61.7% CPU usage
Maximized Window size (not full screen), STANDARD Print: 44.0% - 45.2% CPU usage