Oxide.Rust icon indicating copy to clipboard operation
Oxide.Rust copied to clipboard

CuiHelper Json build optimisation.

Open SkiTee3000 opened this issue 1 year ago • 16 comments

Json build optimisation. Added ability to send UI to the list of players.

According to my tests it reduces serialisation time up to 2-3 times.

SkiTee3000 avatar Dec 17 '23 15:12 SkiTee3000

Correct me if I'm wrong, but this way we loose DefaultValueHandling = DefaultValueHandling.Ignore

In this case every field with default value would be send and it would totally mess up update = true, because every field that I didn't set manually would be updated to default values

Vlad-00003 avatar Dec 19 '23 08:12 Vlad-00003

The default values will not be sent. I have tested on all UI plugins I use, no problems found.

SkiTee3000 avatar Dec 19 '23 09:12 SkiTee3000

Oh, my bad I didn't notice that you're manually checking them in WriteJson

Vlad-00003 avatar Dec 19 '23 09:12 Vlad-00003

Hey, this looks interesting but I'm a bit concerned about some of the default value handling. Some such as the AnchorMin/Max you're not sending if the value is set to "0 0" "1 1", however setting those will change the behavior in-game for some reason. Can we test and make sure the variables we're skipping are actually properly being defaulted on the client? The client code doesn't set the default if the field isn't send in most if not all cases.

MrBlue avatar Jan 29 '24 06:01 MrBlue

Hey, this looks interesting but I'm a bit concerned about some of the default value handling. Some such as the AnchorMin/Max you're not sending if the value is set to "0 0" "1 1", however setting those will change the behavior in-game for some reason. Can we test and make sure the variables we're skipping are actually properly being defaulted on the client? The client code doesn't set the default if the field isn't send in most if not all cases.

I have removed this handling of default values, there may indeed be problems when updating the UI.

SkiTee3000 avatar Jan 29 '24 22:01 SkiTee3000

@MrBlue, could you take a look?

SkiTee3000 avatar Apr 30 '24 01:04 SkiTee3000

Hey @SkiTee3000 would you mind updating this again? Not gonna merge it this wipe but want to try test it before next wipe to make sure there's no issues or breaking changes when we merge it.

MrBlue avatar Jul 01 '24 03:07 MrBlue

Hey @SkiTee3000 would you mind updating this again? Not gonna merge it this wipe but want to try test it before next wipe to make sure there's no issues or breaking changes when we merge it.

updated

SkiTee3000 avatar Jul 01 '24 19:07 SkiTee3000

@MrBlue Check It pls

DezLife avatar Jul 15 '24 19:07 DezLife

@SkiTee3000 Update this for new cooldown fixes

DezLife avatar Jul 24 '24 15:07 DezLife

@DezLife, updated. @MrBlue, can you check?

SkiTee3000 avatar Jul 24 '24 16:07 SkiTee3000

@DezLife, updated. @MrBlue, can you check?

He will add this in an update in the test build. So that it can be tested and then added to the main build

DezLife avatar Jul 24 '24 16:07 DezLife

I just did a benchmark, compared to the current implementation in Oxide the json build is 3 times faster and there is 10% less memory allocation. But I can't say that the results of my benchmark are super accurate, it was done on test data, not on any real ui.

SkiTee3000 avatar Jul 24 '24 17:07 SkiTee3000

I just did a benchmark, compared to the current implementation in Oxide the json build is 3 times faster and there is 10% less memory allocation. But I can't say that the results of my benchmark are super accurate, it was done on test data, not on any real ui.

This implementation will in any case speed up json serialization and reduce allocations

DezLife avatar Jul 24 '24 19:07 DezLife

@SkiTee3000 Add also the ability to DestroyUI for the list of players

DezLife avatar Jul 26 '24 19:07 DezLife