-
Notifications
You must be signed in to change notification settings - Fork 16
Allow selecting patches #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow selecting patches #165
Conversation
|
There's a lot of edits that don't seem intentional...is this properly based on this fork of RPM? |
| @@ -0,0 +1,7 @@ | |||
| namespace JSI | |||
| { | |||
| internal interface IPageElement | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary? There's already a lot of ways to customize page behaviors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RasterPropMonitor contains the state of which orbital patch is selected instead of RPMVesselComputer, otherwise all screens show the same thing, even if you only change one. Currently there's no way to pass the RasterPropMonitor instance to the pages themselves.
There are two main ways I considered. Either add another config variable into the ConfigNode which exposes it publicly and makes it hard to change later since you don't know if downstream dependencies use it, or use an internal interface. I chose the latter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure that scansat or vesselviewer page states are not shared between monitors in the same pod. Is there a way to use the same pattern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those states are local to the page not the monitor. There are other cases like that e.g. the science and target menus. They are not local to the monitor itself. If I switch from one orbital patch on the map screen, on the orbit screen, it will still stay at the old value. Potentially, I could create a "composite" page that contains both pages, but that might require some modification to the page clicking code to allow pages to capture it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks. Let me think about it...
Another example is generic switches; they create persistent variables to track their state per prop. And maybe this state could be stored in the JSIOrbitDisplay? I'm not sure if that's instantiated per monitor or per pod.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another example is generic switches
You might have to provide an example, I'm not sure what you mean when you refer to a "generic switch"
Maybe this state could be stored in the JSIOrbitDisplay
We end up with a worse problem where we need to thread the state of the JSIOrbitDisplay everywhere it's needed. Even the text on the map display wouldn't sync up unless you passed it in.
| private readonly List<string> techsRequired = new List<string>(); | ||
| private readonly string fallbackPageName = string.Empty; | ||
|
|
||
| private readonly PatchSelector patchSelector; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this stuff be moved to a page handler class somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did try this, but it ended with the same code duplicated a few times. Here's what I tried:
- Try to give it it's own handler: doesn't work with ASET 40x20, since they already have the
JSIOrbitDisplayBG handler and the Text switcher for the FG, so there's no other slot. - Add it to the
JSIOrbitDisplay, this works for the map, but then we have to add it somewhere else for the text only page(s) - Add it to the text switcher. This doesn't work for the ASET 60x30 since it doesn't use the text switcher.
So this left me with a few options:
- Duplicate the code/add it to the text switcher, and the map, and maybe somewhere else too
- Modify the
MonitorPageto accept more than two handlers, then we can create our own handler for just the orbit patch switching, but this also means that thePatchSelectorclass has to inheritInternalModuleunnecessarily - Modify the
MonitorPagethe way I did it, which has the disadvantage of having theMonitorPageknow something it probably shouldn't
Let me know what you think, I can choose any of those other options whichever fits best in the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder...how horrible would it be if we just used per-pod variables to start, and then found a better way to do monitor-local ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I'm using this for IVA play, I want to keep them monitor local for personal use and don't have much interest in making them pod local. If monitor local variables are a deal breaker, let me know and I'll leave this unmerged.
| for (int i = 0; i < sourceVarStrings.Length; ++i) | ||
| { | ||
| var variableName = sourceVarStrings[i]; | ||
| if (variableName.StartsWith("MONITOR_LOCAL_")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's probably a much better way to implement monitor-local variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be happy to hear it honestly, there's a lot of changes for what I think should have been a relatively simple fix.
| public bool isConstant => updateType == VariableUpdateType.Constant; | ||
|
|
||
| private double numericValue; | ||
| private string stringValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it turns out that volatile variables do not update these cached values, so reading them directly is a bug. Hence the visibility change.
|
I've tried to minimise the patch as much as possible. Now the changes are mainly in the |
| "", | ||
| (RPMVesselComputer _) => evaluator(), | ||
| null, | ||
| VariableUpdateType.Volatile, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
volatile variables are horrible for performance. Need to rework this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate to be that guy, but volatile variables actually have good performance. I changed all variables to be volatile, disabled caching entirely, and it actually made the code faster. I've provided the raw data below. The result is that the rendering time of the screens themselves is effectively unchanged (the control is actually marginally slower), but the time spent in the pod computer is significantly worse when caching variables.
This makes sense, CPUs are fast at math and generally slow at lookups. Also, the way that the variables are set up, we end up calculating a bunch of things that are never actually used.
The code is on this branch https://github.com/andymac-2/RasterPropMonitor/commits/profiling-volatile/ if you want to try it yourself. The commit titled "Volatile" has all variables volatile, and the commit titled "Control" just has the profiling code added, but no other changes. I used a vessel with a Mk3 command pod with DE_IVA and a probe core. The measurements were taken inside the Mk3, every screen showed something different.
All Variables Volatile
[LOG 22:18:31.668] Profiled RPMComputer, 1000 iterations, mean: 75.404, std deviation: 662.863199147456
[LOG 22:18:31.669] Profiled RPMComputer, 1000 iterations, mean: 6.026, std deviation: 34.940196393266
[LOG 22:18:31.672] Profiled RPM, 1000 iterations, mean: 1084.929, std deviation: 17125.6115675312
[LOG 22:18:31.672] Profiled RPM, 1000 iterations, mean: 716.104, std deviation: 7872.96813350492
[LOG 22:18:31.672] Profiled RPM, 1000 iterations, mean: 3114.814, std deviation: 10723.0231415121
[LOG 22:18:31.672] Profiled RPM, 1000 iterations, mean: 100.543, std deviation: 1790.03413491224
[LOG 22:18:31.672] Profiled RPM, 1000 iterations, mean: 360.218, std deviation: 3244.6364092878
[LOG 22:18:48.278] Profiled RPMComputer, 1000 iterations, mean: 62.639, std deviation: 58.6548095129462
[LOG 22:18:48.279] Profiled RPMComputer, 1000 iterations, mean: 6.022, std deviation: 2.76251986418197
[LOG 22:18:48.282] Profiled RPM, 1000 iterations, mean: 953.266, std deviation: 1152.76742547836
[LOG 22:18:48.282] Profiled RPM, 1000 iterations, mean: 840.151, std deviation: 1477.70059152692
[LOG 22:18:48.283] Profiled RPM, 1000 iterations, mean: 5234.784, std deviation: 1744.5479297927
[LOG 22:18:48.283] Profiled RPM, 1000 iterations, mean: 73.639, std deviation: 202.143025303867
[LOG 22:18:48.283] Profiled RPM, 1000 iterations, mean: 456.635, std deviation: 682.964490859517
[LOG 22:19:00.430] Profiled RPMComputer, 1000 iterations, mean: 61.205, std deviation: 55.0661509005305
[LOG 22:19:00.430] Profiled RPMComputer, 1000 iterations, mean: 5.958, std deviation: 2.36817144649622
[LOG 22:19:00.434] Profiled RPM, 1000 iterations, mean: 994.616, std deviation: 635.473291762919
[LOG 22:19:00.434] Profiled RPM, 1000 iterations, mean: 872.221, std deviation: 1558.48747898692
[LOG 22:19:00.435] Profiled RPM, 1000 iterations, mean: 5189.059, std deviation: 1312.00925207065
[LOG 22:19:00.435] Profiled RPM, 1000 iterations, mean: 82.831, std deviation: 156.931502379223
[LOG 22:19:00.435] Profiled RPM, 1000 iterations, mean: 500.192, std deviation: 761.118974363404
[LOG 22:19:12.225] Profiled RPMComputer, 1000 iterations, mean: 63.23, std deviation: 54.8854907967488
[LOG 22:19:12.225] Profiled RPMComputer, 1000 iterations, mean: 6.546, std deviation: 2.30692089157821
[LOG 22:19:12.230] Profiled RPM, 1000 iterations, mean: 1148.944, std deviation: 748.334646307386
[LOG 22:19:12.230] Profiled RPM, 1000 iterations, mean: 1021.039, std deviation: 1808.34538721976
[LOG 22:19:12.231] Profiled RPM, 1000 iterations, mean: 6147.691, std deviation: 1418.97513139555
[LOG 22:19:12.231] Profiled RPM, 1000 iterations, mean: 90.308, std deviation: 122.702954878846
[LOG 22:19:12.231] Profiled RPM, 1000 iterations, mean: 597.537, std deviation: 896.991627960373
[LOG 22:19:24.584] Profiled RPMComputer, 1000 iterations, mean: 77.233, std deviation: 72.445059948902
[LOG 22:19:24.585] Profiled RPMComputer, 1000 iterations, mean: 8.1, std deviation: 4.62709412050371
[LOG 22:19:24.591] Profiled RPM, 1000 iterations, mean: 1232.088, std deviation: 759.264016173557
[LOG 22:19:24.591] Profiled RPM, 1000 iterations, mean: 1184.096, std deviation: 2121.64181632622
[LOG 22:19:24.592] Profiled RPM, 1000 iterations, mean: 7327.487, std deviation: 4237.97957897758
[LOG 22:19:24.592] Profiled RPM, 1000 iterations, mean: 94.302, std deviation: 143.058690040137
[LOG 22:19:24.592] Profiled RPM, 1000 iterations, mean: 665.547, std deviation: 1022.86560104004
[LOG 22:19:37.323] Profiled RPMComputer, 1000 iterations, mean: 85.044, std deviation: 79.9289563550032
[LOG 22:19:37.323] Profiled RPMComputer, 1000 iterations, mean: 8.775, std deviation: 3.94871814643689
[LOG 22:19:37.328] Profiled RPM, 1000 iterations, mean: 1166.689, std deviation: 710.288504960484
[LOG 22:19:37.328] Profiled RPM, 1000 iterations, mean: 1243.926, std deviation: 2200.82287986198
[LOG 22:19:37.328] Profiled RPM, 1000 iterations, mean: 7577.164, std deviation: 1863.42335799034
[LOG 22:19:37.328] Profiled RPM, 1000 iterations, mean: 90.383, std deviation: 120.084521529629
[LOG 22:19:37.328] Profiled RPM, 1000 iterations, mean: 671.339, std deviation: 1031.51097331972
[LOG 22:19:52.707] Profiled RPMComputer, 1000 iterations, mean: 75.243, std deviation: 69.4086158268554
[LOG 22:19:52.708] Profiled RPMComputer, 1000 iterations, mean: 7.723, std deviation: 4.22330096014954
[LOG 22:19:52.711] Profiled RPM, 1000 iterations, mean: 1069.802, std deviation: 642.688012021385
[LOG 22:19:52.711] Profiled RPM, 1000 iterations, mean: 1062.717, std deviation: 1959.25145882579
[LOG 22:19:52.712] Profiled RPM, 1000 iterations, mean: 6632.232, std deviation: 2373.17821500536
[LOG 22:19:52.712] Profiled RPM, 1000 iterations, mean: 79.975, std deviation: 130.561496525584
[LOG 22:19:52.712] Profiled RPM, 1000 iterations, mean: 577.934, std deviation: 910.27164497418
[LOG 22:20:10.240] Profiled RPMComputer, 1000 iterations, mean: 63.237, std deviation: 61.9716453791571
[LOG 22:20:10.241] Profiled RPMComputer, 1000 iterations, mean: 6.072, std deviation: 3.23400927642454
[LOG 22:20:10.244] Profiled RPM, 1000 iterations, mean: 916.367, std deviation: 501.339703505517
[LOG 22:20:10.244] Profiled RPM, 1000 iterations, mean: 785.971, std deviation: 1408.00953624576
[LOG 22:20:10.244] Profiled RPM, 1000 iterations, mean: 5202.455, std deviation: 1352.22713475769
[LOG 22:20:10.244] Profiled RPM, 1000 iterations, mean: 62.509, std deviation: 79.6903878708091
[LOG 22:20:10.244] Profiled RPM, 1000 iterations, mean: 473.438, std deviation: 1143.41525796886
[LOG 22:20:27.754] Profiled RPMComputer, 1000 iterations, mean: 61.345, std deviation: 55.8552412491433
[LOG 22:20:27.755] Profiled RPMComputer, 1000 iterations, mean: 5.785, std deviation: 1.98564221349165
[LOG 22:20:27.758] Profiled RPM, 1000 iterations, mean: 890.633, std deviation: 497.090863234278
[LOG 22:20:27.758] Profiled RPM, 1000 iterations, mean: 771.809, std deviation: 1353.32693186791
[LOG 22:20:27.758] Profiled RPM, 1000 iterations, mean: 5160.602, std deviation: 1359.50835951678
[LOG 22:20:27.758] Profiled RPM, 1000 iterations, mean: 62.643, std deviation: 82.9882856251411
[LOG 22:20:27.758] Profiled RPM, 1000 iterations, mean: 443.863, std deviation: 656.034977902093
[LOG 22:20:45.108] Profiled RPMComputer, 1000 iterations, mean: 69.658, std deviation: 65.459537395249
[LOG 22:20:45.109] Profiled RPMComputer, 1000 iterations, mean: 6.168, std deviation: 2.3966176165588
[LOG 22:20:45.112] Profiled RPM, 1000 iterations, mean: 992.043, std deviation: 570.791481323084
[LOG 22:20:45.112] Profiled RPM, 1000 iterations, mean: 806.709, std deviation: 1418.15187068205
[LOG 22:20:45.113] Profiled RPM, 1000 iterations, mean: 5210.462, std deviation: 1002.30869623884
[LOG 22:20:45.113] Profiled RPM, 1000 iterations, mean: 65.484, std deviation: 86.5264800162355
[LOG 22:20:45.113] Profiled RPM, 1000 iterations, mean: 459.273, std deviation: 672.592330071493
[LOG 22:21:02.416] Profiled RPMComputer, 1000 iterations, mean: 68.669, std deviation: 61.1190759010638
[LOG 22:21:02.416] Profiled RPMComputer, 1000 iterations, mean: 6.335, std deviation: 2.37418933533112
[LOG 22:21:02.419] Profiled RPM, 1000 iterations, mean: 1041.177, std deviation: 563.654945574861
[LOG 22:21:02.419] Profiled RPM, 1000 iterations, mean: 862.451, std deviation: 1742.1285221243
[LOG 22:21:02.420] Profiled RPM, 1000 iterations, mean: 5386.811, std deviation: 1145.72623312858
[LOG 22:21:02.420] Profiled RPM, 1000 iterations, mean: 68.77, std deviation: 92.5295579801395
[LOG 22:21:02.420] Profiled RPM, 1000 iterations, mean: 481.04, std deviation: 707.721168540266
[LOG 22:21:19.736] Profiled RPMComputer, 1000 iterations, mean: 70.266, std deviation: 64.0146799101581
[LOG 22:21:19.737] Profiled RPMComputer, 1000 iterations, mean: 6.349, std deviation: 2.50663100595201
[LOG 22:21:19.740] Profiled RPM, 1000 iterations, mean: 1085.676, std deviation: 670.502466083459
[LOG 22:21:19.740] Profiled RPM, 1000 iterations, mean: 882.119, std deviation: 1561.23103506144
[LOG 22:21:19.741] Profiled RPM, 1000 iterations, mean: 5527.204, std deviation: 1313.53595321331
[LOG 22:21:19.741] Profiled RPM, 1000 iterations, mean: 73.502, std deviation: 99.8692044426108
[LOG 22:21:19.741] Profiled RPM, 1000 iterations, mean: 493.24, std deviation: 728.316958748044
[LOG 22:21:38.044] Profiled RPMComputer, 1000 iterations, mean: 80.069, std deviation: 70.1365684860615
[LOG 22:21:38.045] Profiled RPMComputer, 1000 iterations, mean: 8.23, std deviation: 3.22104020465439
[LOG 22:21:38.051] Profiled RPM, 1000 iterations, mean: 1329.408, std deviation: 873.471377628368
[LOG 22:21:38.051] Profiled RPM, 1000 iterations, mean: 1367.73, std deviation: 2535.48918299803
[LOG 22:21:38.053] Profiled RPM, 1000 iterations, mean: 8627.817, std deviation: 3305.34310556574
[LOG 22:21:38.053] Profiled RPM, 1000 iterations, mean: 113.139, std deviation: 168.926148594586
[LOG 22:21:38.053] Profiled RPM, 1000 iterations, mean: 771.036, std deviation: 1286.93592719451
Control
[LOG 22:30:44.460] Profiled RPMComputer, 1000 iterations, mean: 759.234, std deviation: 1708.42734854134
[LOG 22:30:44.461] Profiled RPMComputer, 1000 iterations, mean: 5.897, std deviation: 31.4273191825202
[LOG 22:30:44.464] Profiled RPM, 1000 iterations, mean: 1063.328, std deviation: 17426.6057490383
[LOG 22:30:44.464] Profiled RPM, 1000 iterations, mean: 743.639, std deviation: 8592.33329141037
[LOG 22:30:44.465] Profiled RPM, 1000 iterations, mean: 3351.171, std deviation: 11400.5851354112
[LOG 22:30:44.465] Profiled RPM, 1000 iterations, mean: 85.87, std deviation: 1683.5336210186
[LOG 22:30:44.465] Profiled RPM, 1000 iterations, mean: 363.515, std deviation: 3379.29124488775
[LOG 22:30:58.229] Profiled RPMComputer, 1000 iterations, mean: 1171.025, std deviation: 1403.74937163833
[LOG 22:30:58.230] Profiled RPMComputer, 1000 iterations, mean: 6.198, std deviation: 2.52760677321454
[LOG 22:30:58.233] Profiled RPM, 1000 iterations, mean: 873.713, std deviation: 481.540887808086
[LOG 22:30:58.233] Profiled RPM, 1000 iterations, mean: 832.894, std deviation: 1459.25436328421
[LOG 22:30:58.233] Profiled RPM, 1000 iterations, mean: 5076.547, std deviation: 1143.54592465323
[LOG 22:30:58.233] Profiled RPM, 1000 iterations, mean: 62.338, std deviation: 153.339022287218
[LOG 22:30:58.233] Profiled RPM, 1000 iterations, mean: 469.278, std deviation: 901.79425076677
[LOG 22:31:10.052] Profiled RPMComputer, 1000 iterations, mean: 1208.776, std deviation: 1282.45749942211
[LOG 22:31:10.052] Profiled RPMComputer, 1000 iterations, mean: 6.902, std deviation: 2.8629348577989
[LOG 22:31:10.056] Profiled RPM, 1000 iterations, mean: 1002.542, std deviation: 575.619829606312
[LOG 22:31:10.056] Profiled RPM, 1000 iterations, mean: 940.085, std deviation: 1643.34700589224
[LOG 22:31:10.056] Profiled RPM, 1000 iterations, mean: 5652.571, std deviation: 1320.02625237493
[LOG 22:31:10.056] Profiled RPM, 1000 iterations, mean: 62.876, std deviation: 81.5546603450716
[LOG 22:31:10.057] Profiled RPM, 1000 iterations, mean: 508.791, std deviation: 751.457209240154
[LOG 22:31:22.213] Profiled RPMComputer, 1000 iterations, mean: 1530.298, std deviation: 1702.24868664834
[LOG 22:31:22.214] Profiled RPMComputer, 1000 iterations, mean: 8.763, std deviation: 6.75801975433633
[LOG 22:31:22.218] Profiled RPM, 1000 iterations, mean: 1122.307, std deviation: 606.450857655425
[LOG 22:31:22.218] Profiled RPM, 1000 iterations, mean: 1176.464, std deviation: 2054.63126635998
[LOG 22:31:22.219] Profiled RPM, 1000 iterations, mean: 7253.298, std deviation: 4717.80603747081
[LOG 22:31:22.219] Profiled RPM, 1000 iterations, mean: 76.563, std deviation: 113.699797849425
[LOG 22:31:22.219] Profiled RPM, 1000 iterations, mean: 610.879, std deviation: 924.675732545739
[LOG 22:31:38.245] Profiled RPMComputer, 1000 iterations, mean: 1183.103, std deviation: 1319.78029019644
[LOG 22:31:38.246] Profiled RPMComputer, 1000 iterations, mean: 6.436, std deviation: 3.52276936514442
[LOG 22:31:38.250] Profiled RPM, 1000 iterations, mean: 884.048, std deviation: 472.053469107049
[LOG 22:31:38.250] Profiled RPM, 1000 iterations, mean: 846.863, std deviation: 1492.55929672191
[LOG 22:31:38.250] Profiled RPM, 1000 iterations, mean: 5342.942, std deviation: 1217.36569223714
[LOG 22:31:38.250] Profiled RPM, 1000 iterations, mean: 53.462, std deviation: 86.0022473892398
[LOG 22:31:38.250] Profiled RPM, 1000 iterations, mean: 448.842, std deviation: 669.582484116782
[LOG 22:31:50.650] Profiled RPMComputer, 1000 iterations, mean: 1570.678, std deviation: 1742.94977102497
[LOG 22:31:50.650] Profiled RPMComputer, 1000 iterations, mean: 8.683, std deviation: 3.77816238401686
[LOG 22:31:50.655] Profiled RPM, 1000 iterations, mean: 1115.68, std deviation: 582.96654072082
[LOG 22:31:50.655] Profiled RPM, 1000 iterations, mean: 1195.135, std deviation: 2074.62584259789
[LOG 22:31:50.656] Profiled RPM, 1000 iterations, mean: 7342.034, std deviation: 1638.62352871061
[LOG 22:31:50.656] Profiled RPM, 1000 iterations, mean: 69.049, std deviation: 88.296594492653
[LOG 22:31:50.656] Profiled RPM, 1000 iterations, mean: 618.693, std deviation: 929.855474120038
[LOG 22:32:03.607] Profiled RPMComputer, 1000 iterations, mean: 1550.901, std deviation: 1707.77623510781
[LOG 22:32:03.607] Profiled RPMComputer, 1000 iterations, mean: 9.209, std deviation: 6.02920550321516
[LOG 22:32:03.612] Profiled RPM, 1000 iterations, mean: 1134.594, std deviation: 608.149864066416
[LOG 22:32:03.612] Profiled RPM, 1000 iterations, mean: 1258.991, std deviation: 2196.76319955497
[LOG 22:32:03.613] Profiled RPM, 1000 iterations, mean: 7829.923, std deviation: 1894.45444734652
[LOG 22:32:03.613] Profiled RPM, 1000 iterations, mean: 70.891, std deviation: 90.6429981796719
[LOG 22:32:03.613] Profiled RPM, 1000 iterations, mean: 651.945, std deviation: 982.415656417893
[LOG 22:32:18.023] Profiled RPMComputer, 1000 iterations, mean: 1850.913, std deviation: 1977.71660999017
[LOG 22:32:18.023] Profiled RPMComputer, 1000 iterations, mean: 10.179, std deviation: 5.54679718396121
[LOG 22:32:18.029] Profiled RPM, 1000 iterations, mean: 1066.576, std deviation: 505.668636781045
[LOG 22:32:18.029] Profiled RPM, 1000 iterations, mean: 1375.141, std deviation: 2375.4365087535
[LOG 22:32:18.030] Profiled RPM, 1000 iterations, mean: 8864.842, std deviation: 1818.62893714908
[LOG 22:32:18.030] Profiled RPM, 1000 iterations, mean: 67.706, std deviation: 84.748743731102
[LOG 22:32:18.030] Profiled RPM, 1000 iterations, mean: 699.082, std deviation: 1064.21504089916
[LOG 22:32:34.175] Profiled RPMComputer, 1000 iterations, mean: 1851.8, std deviation: 1920.17357236267
[LOG 22:32:34.175] Profiled RPMComputer, 1000 iterations, mean: 10.43, std deviation: 4.39375693456067
[LOG 22:32:34.181] Profiled RPM, 1000 iterations, mean: 1315.97, std deviation: 6710.10875121261
[LOG 22:32:34.181] Profiled RPM, 1000 iterations, mean: 1572.256, std deviation: 2724.67755128272
[LOG 22:32:34.182] Profiled RPM, 1000 iterations, mean: 10200.583, std deviation: 2429.28127583263
[LOG 22:32:34.182] Profiled RPM, 1000 iterations, mean: 78.757, std deviation: 158.870764934899
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm VERY skeptical.
Can you explain what these lines mean? Why is the second one so much faster?
[LOG 22:31:50.650] Profiled RPMComputer, 1000 iterations, mean: 1570.678, std deviation: 1742.94977102497
[LOG 22:31:50.650] Profiled RPMComputer, 1000 iterations, mean: 8.683, std deviation: 3.77816238401686
It's true that we update a lot of variables that may not eventually be used - but I have another TODO to address that.
The big win for stable variables is when it allows string formatters to not need to run. If there is a variable in the string that is going to be changing every frame anyway, then volatile variables probably aren't hurting anything.
I'd be curious to see dottrace captures from these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what these lines mean? Why is the second one so much faster?
Those two lines are the profiling results from the two RasterPropMonitorComputer instances on the vessel I'm measuring the entirety of the Update call so I don't get caught out by making the benchmarks too small. I have a pod and a probe. The probe computer is faster because all of the screens in the probe control room are on standby. there are five monitors in the Mk3 pod, so there are five RasterPropMonitor instances.
The big win for stable variables is when it allows string formatters to not need to run.
The formatter check is still performed for volatile variables, so they are equal in this regard. The only difference is the value is recalculated after a call to Get(), not whether the formatter compares the old and new variables.
If there is a variable in the string that is going to be changing every frame anyway
Non-volatile variables are calculated every frame anyway, so there is no difference. RasterPropMonitor sets the "data" refresh rate to the "screen" refresh rate on initialisation. Volatile variables are mostly calculated once per frame, but sometimes more if the value is displayed on different monitors.
So for volatile variables, we mainly calculate them once per frame, and never calculate an unused variable. For non-volatile variables, we calculate them all once per frame, including unused variables, and have to look them up later (in LateUpdate as well, so these values have almost certainly been bumped from cache). This explains the speed difference
|
I think it's probably wise to remove the monitor-local stuff and just use per-pod variables for the patch selections. Then we can work on making a good local variable system - ideally per prop and not specific to monitors. |
Fair enough. I'll change that over. |
Patch to allow selecting orbits from the RPM screens. Useful for interplanetary and lunar travel. Let me know if this is something you want in your trunk.
At the moment, this doesn't do anything by default, I've got a patch for ASET that makes this work.
Also includes some other fixes:
IvaPatchSelector3.mp4
IvaPatchSelector2.mp4