pjf / masterwork-dwarf-fortress

Patches and bugfixes applied to Meph's amazing Masterwork Dwarf Fortress
33 stars 22 forks source link

Settings program is slow #57

Open pjf opened 10 years ago

pjf commented 10 years ago

In trying to track down another bug, I noticed that the current settings program is significantly slower (on all screens) than the one that was bundled with 4e. At least it's slower when running under wine, but I assume from mentions in the forum threads it's also slow when running under a native OS as well.

I have no idea what's causing the slow-down, but I'm raising this issue as it means we have a known point in time (4e) when it was running swiftly.

(Looking at @splintermind here with big adorable eyes in case he spots an obvious cause of slowness, and/or has access to a profiler.)

splintermind commented 10 years ago

What kind of slow down are we talking about? It's slow to change tabs? Slow to change options? Slow on the initial load?

pjf commented 10 years ago

It's slow to render, including both on initial load and when changing tabs. The 4e setting program immediately gives you have a screen of settings you can modify. The new settings program involves waiting while it painstakingly draws each individual display element. This occurs on every tab (although it's particularly noticeable on civilisations).

I know that switching to the 'grey' theme speeds things up a lot, although actually switching themes takes a long time. I'm not sure if the grey theme gives us the same speed as the original 4e program; I only noticed how much of a speed difference there was while checking out different versions to figure out which one introduced frozen boozebelly rum logs to Taiga Orcs...

pjf commented 10 years ago

And if the window gets obscured and revealed, there's the whole joy of waiting for it to re-render again. I can possibly do a video if you wish...

splintermind commented 10 years ago

Ok I've setup another version with a different tab control that hopefully will resolve or help with the windows xp compatibility and the performance issues. Give it a try and let me know how things are under wine.

https://github.com/splintermind/masterwork-dwarf-fortress-alt

If you want to test on an existing install, just add the KRBTabControl.dll to the MasterworkDwarfFortress folder, and use the new executable in the top directory of the repository. That's all that should be required.

pjf commented 10 years ago

Okay, shall test now. Did you mean for it to be in an entirely new repository? Branching in git is really easy, and very lightweight:

$ git checkout -b my_branch     #  Create a branch based on where I am, and switch to it

< hack; commit; etc>

$ git push origin my_branch     # Push my_branch to github
$ git checkout master           # Switch back to my master branch
$ git checkout my_branch        # Switch to my_branch again
$ git branch -d my_branch       # Delete branch (if fully merged

Git is smart enough to remember once you've pushed a branch and to continue to push it any time you do a 'git push' from your repo.

For larger projects, one usually does a branch per feature, which then gets merged once it's been through development and testing. It's common to see lots of branches when working with git, and I'll regularly make temporary branches for doing all sorts of odds and ends.

In any case, I'll go test these changes now. :) (And git is awesome, since I can run a git remote add splinterz2 git@github.com:splintermind/masterwork-dwarf-fortress-alt.git in my existing repo and it'll treat your repo as just another remote branch of mine!)

~ Paul

pjf commented 10 years ago

I hate to be the bearer of bad news, but I'm using eb144d4bd800752870c2e6c61948785ff5710656, and it's slower (at least under wine 1.7.7). The civs screen not only updates slowly, but has noticeable pauses. The other screens continue to update slowly. :(

The blue theme is still quite snappy; it has a few noticeable pauses, but they're tiny. I don't feel like going to watch youtube videos while it updates. :)

One possible workaround is to use the blue theme by default. It's not as pretty, but the user experience is much nicer.

(Again, I don't have a windows machine easily handy to test these on, so it may be snappy there.)

splintermind commented 10 years ago

Well it's got to be something with transparencies then. The blue theme uses far less transparent/semi-transparent controls.

I've tested things on xp, and most of the issues there seem to be ok now. I don't know why wine is rendering things so differently.

Was changing themes any different?

pjf commented 10 years ago

Changing themes felt much faster than in the past, so that's good. :)

And yes, I'm guessing it's definitely to do with transparencies; the non-transparent parts process very quickly. :) (And it may well be because the wine code for transparencies is a stub, and so they're being calculated through some insanely slow process.)

Delighted to hear that it tells well on XP. :)

splintermind commented 10 years ago

Alright I've updated the 'blue' theme in the test repo with solid colors for the containing controls, so see if that's any better.

As an additional test I've set the background for each tab this time as well, I'm not sure if that will make any difference.

pjf commented 10 years ago

That's awesome! The blue theme changes pages instantly. There's no lag. It's the fastest masterwork settings program I've ever used under wine. :)

\o/

pjf commented 10 years ago

Given that this passes the 'more awesome than the last version' test, are you happy with me merging the new settings program into SWP?

splintermind commented 10 years ago

I've just got to re-arrange things a bit and finish up a bit of formatting for the new tab and then it should be good to go.

pjf commented 10 years ago

Aye aye! Let me know when. :)

splintermind commented 10 years ago

Ok should be ready! I've updated my main fork as well if that's easier.

pjf commented 10 years ago

Merged! Thank you very much!

splintermind commented 10 years ago

I've made a few more performance tweaks on the alt branch. These are specifically targeted to wine and/or windows xp, so test them out and see if it helps!

Edit: From my testing the changes pass the 'better than before' test, so I've updated my main branch as well.

pjf commented 10 years ago

I've responded on the forums.

They've also passed my 'better than before' test, so they're merged upstream. :)