Merge lp:~widelands-dev/widelands/quarry_tweaks into lp:widelands

Proposed by TiborB
Status: Merged
Merged at revision: 7439
Proposed branch: lp:~widelands-dev/widelands/quarry_tweaks
Merge into: lp:widelands
Diff against target: 49 lines (+15/-3)
2 files modified
tribes/atlanteans/quarry/conf (+7/-1)
tribes/barbarians/quarry/conf (+8/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/quarry_tweaks
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+254632@code.launchpad.net

Description of the change

Chanching syntax of quarries conf files (atlanteans and barbarians) to be like empire's one.

This is a peformance tweak - to insert a sleep time after failed search for stones.

And it breaks the savefile compatibility, it seems :)

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

lgtm, but I do not think that the productivity still drops fast now, does it? I do not think that is necessary a really bad problem, I think consistency is more important.

review: Approve
Revision history for this message
wl-zocker (wl-zocker) wrote :

I have tested it in game. The productivity does not drop as fast as before (5%/5ms, IIRC), but still rather quickly (about 5%/1s). "This order" refers to the fact that the sleep command comes after the worker=cut and is therefore not executed when the first command failes. I changed the order for all buildings to avoid busy waiting, except for the quarries, hence the comment. IMHO it is still valid to keep it.

Where does the additional timeout come from? Based on the conf files, I'd say the logic stays the same, it has only become more verbose.

Revision history for this message
TiborB (tiborb95) wrote :

My concern is not productivity drop, but too frequent calling run_findobject() function that is quite expensive, especially if it is called around without interruption.

I dont undestand the timing - I noticed there is 10 seconds of gap instead of 25 as I would expect, but for my purposes (performance) this does not make much difference. But 10 seconds is mentioned in stonemanson's conf file.

Revision history for this message
wl-zocker (wl-zocker) wrote :

The 10 seconds is how long the stonemason is hacking on the rocks (I did not measure that time). After having returned, he sleeps 25 seconds, that is what I have measured (5s at 5x speed).

I know your goal was to reduce the CPU consumption. I have done no profiling to see if that has reduced, but I guess whenever findobject fails, the productivity drops by 5%, so those two are related. My comment was mainly an answer to SirVer's diff comment.

Revision history for this message
TiborB (tiborb95) wrote :

I think things there do not work as supposed, but I have no time to tinker with this.

10 seconds period means that statistics should be updated once in 10 seconds and decreased by 5% - I believe...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tribes/atlanteans/quarry/conf'
2--- tribes/atlanteans/quarry/conf 2014-08-02 19:55:23 +0000
3+++ tribes/atlanteans/quarry/conf 2015-03-30 18:56:08 +0000
4@@ -16,13 +16,19 @@
5 stonecutter=1
6
7 [programs]
8+# TRANSLATORS: "Completed/Skipped/Did not start quarrying stone because ...
9+mine_stone=_quarrying stone
10 # TRANSLATORS: "Completed/Skipped/Did not start working because ...
11 work=_working
12
13-[work]
14+[mine_stone]
15 worker=cut_stone # This order is on purpose so that the productivity
16 sleep=25000 # drops fast once all stones are gone.
17
18+[work]
19+call=mine_stone
20+return=skipped
21+
22 [out_of_resource_notification]
23 title=_Out of Rocks
24 message=_The stonecutter working at this quarry can’t find any rocks in his working radius.
25
26=== modified file 'tribes/barbarians/quarry/conf'
27--- tribes/barbarians/quarry/conf 2015-02-12 19:46:19 +0000
28+++ tribes/barbarians/quarry/conf 2015-03-30 18:56:08 +0000
29@@ -15,12 +15,18 @@
30 stonemason=1
31
32 [programs]
33+# TRANSLATORS: "Completed/Skipped/Did not start quarrying stone because ...
34+mine_stone=_quarrying stone
35 # TRANSLATORS: "Completed/Skipped/Did not start working because ...
36 work=_working
37
38+[mine_stone]
39+worker=cut # This order is on purpose so that the productivity
40+sleep=25000 # drops fast once all stones are gone.
41+
42 [work]
43-worker=cut # This order is on purpose so that the productivity
44-sleep=25000 # drops fast once all stones are gone.
45+call=mine_stone
46+return=skipped
47
48 [out_of_resource_notification]
49 title=_Out of Rocks

Subscribers

People subscribed via source and target branches

to status/vote changes: