MobiFlight-WASM-Module
MobiFlight-WASM-Module copied to clipboard
Avoid duplicated reading RPN code execution across multiple clients
@Koseng
While multiple clients Add(MF.SimVars.Add.xxxxRPNcodexxx) the exact same SimVars to WASM, From MSFS2020 perspective, it is unnecessary to execute the same RPNcode several times in each frame. This is an enhancement change to reduce FPS impact WASM will smartly execute duplicated SimVars only once in each frame.
introduce new data structure:
//RPN code execution for reading values in every frame
struct ReadRPNCode {
std::string Code;
int RetType; //RetType: 0:float 1:integer 2:string
std::vector<SimVar> SimVars;
std::vector<StringSimVar> StringSimVars;
};
i am currently at FSWeekend, i will be looking at this PR next week
@DocMoebiuz Could you take a look?
Not yet tbh :(
Does this work with strings too? yeah, looks like you are also treating strings.
How much of an impact is this? What did you see in FPS drop?
std::vector<SimVar> SimVars; std::vector<StringSimVar> StringSimVars;
so string is considered in this change. I don't have direct evidence to see FPS drop, but this change will improve FPS when we have multiple clients
@DocMoebiuz think about you have multiple clients, but they have exact same simvars (L:N_FCU_HEADING), then WASM will execute "(L:N_FCU_HEADING)" multiple times in MSFS one frame update, it is totally waste of FPS
@cpuwolf you marked some of the comments as resolved but you might not have pushed your changes yet.
@cpuwolf you marked some of the comments as resolved but you might not have pushed your changes yet.
should I resubmit the pull? I am expecting Github can do online review and revise the code realtime
You have to make the changes in your branch and simply push the branch again. The PR will automatically update then. But simply resolving the conversation doesn't do it.