Create account / Log in

Am I doing this right?

Discussion area for the development team.

Moderators: uckelman, Tim M

Am I doing this right?

Postby Cattlesquat » July 28th, 2020, 5:34 pm

Flint1b -- I did the git commands below and couldn't tell any difference, so I think maybe I'm not building correctly or maybe I'm on the wrong branch or something? Brian

git fetch upstream pull/75/head:Try75
git checkout Try75
User avatar
Cattlesquat
 
Posts: 953
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Am I doing this right?

Postby uckelman » July 28th, 2020, 5:38 pm

Thus spake Cattlesquat:
> Flint1b -- I did the git commands below and couldn't tell any
> difference, so I think maybe I'm not building correctly or maybe I'm on
> the wrong branch or something? Brian
>
> git fetch upstream pull/75/head:Try75
> git checkout Try75

Does 'git log' show the same commit at HEAD for your Try75 branch
as the last commit on the PR on GitHub?

--
J.
User avatar
uckelman
Site Admin
 
Posts: 9014
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Am I doing this right?

Postby Cattlesquat » July 28th, 2020, 5:41 pm

It shows the same commit message as the last commit message in the list ("save property map instead of piece clone as snapshot").
There's a force-push listed in the PR below the commit that isn't shown, but not sure it's supposed to.
User avatar
Cattlesquat
 
Posts: 953
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Am I doing this right?

Postby uckelman » July 28th, 2020, 5:47 pm

Thus spake Cattlesquat:
> It shows the same commit message as the last commit message in the list
> ("save property map instead of piece clone as snapshot").
> There's a force-push listed in the PR below the commit that isn't shown,
> but not sure it's supposed to.

As that's the only commit in PR 75, if that's HEAD on your Try75 branch
and you're on your Try75 branch, then you've got the PR checked out.

--
J.
User avatar
uckelman
Site Admin
 
Posts: 9014
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Am I doing this right?

Postby Cattlesquat » July 28th, 2020, 5:54 pm

Well dang. All that seems to be true. I wonder why I'm not seeing any perf increase.
User avatar
Cattlesquat
 
Posts: 953
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Am I doing this right?

Postby Flint1b » July 28th, 2020, 6:35 pm

Hmm.... when I try this first module with current master, add 4-5 of each piece to the map, right click and count, it takes about 2-3 seconds. When I try the same with this PR, it only takes about 1 second. And I get similar relative results with the second module.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Am I doing this right?

Postby Cattlesquat » July 28th, 2020, 7:14 pm

Flint1b wrote:Hmm.... when I try this first module with current master, add 4-5 of each piece to the map, right click and count, it takes about 2-3 seconds. When I try the same with this PR, it only takes about 1 second. And I get similar relative results with the second module.


Oh wow. With current master the test case you describe is "effectively instantaneous" so I see why I'm confused.

Also that gives me a whole new impression of your earlier statement that "Paths of Glory runs like a dog" :O I'm horrified to even think!
User avatar
Cattlesquat
 
Posts: 953
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Am I doing this right?

Postby m3tan » July 28th, 2020, 7:29 pm

Cattlesquat wrote:Also that gives me a whole new impression of your earlier statement that "Paths of Glory runs like a dog" :O I'm horrified to even think!

And this is why I choose not to drink from the firehose...
User avatar
m3tan
 
Posts: 210
Joined: August 12th, 2018, 11:49 pm

Re: Am I doing this right?

Postby Cattlesquat » July 28th, 2020, 7:32 pm

Naw, ya gotta drink! Who's ever worked as a professional developer and not suddenly found out their thing breaks/lags/etc on some other computer or in some other use case and had to fix something? This is how Vassal gets better!
User avatar
Cattlesquat
 
Posts: 953
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Am I doing this right?

Postby Cattlesquat » July 28th, 2020, 7:37 pm

But anyway, Flint1b -- now drill down on those modules under YOUR branch and see if you can speed up Global Key Commands themselves!
User avatar
Cattlesquat
 
Posts: 953
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: Am I doing this right?

Postby Flint1b » July 28th, 2020, 8:30 pm

Cattlesquat wrote:Oh wow. With current master the test case you describe is "effectively instantaneous" so I see why I'm confused.

Also that gives me a whole new impression of your earlier statement that "Paths of Glory runs like a dog" :O I'm horrified to even think!


I think Brent said this with the dog but yea on my computer it's very slow. I am so used to getting a top notch computer from my employers that I don't bother getting a fast and expensive one for myself, as long as I can watch youtube, netflix, play the occasional game and run ms-dos and windows emulators for old games, I'm happy.

That one module I play in PBEM, it does load somewhat faster than Paths of Glory, but I already made it a habit getting a drink while it loads up the opponents log, when I come back it has loaded the counters and almost finished loading the map.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Am I doing this right?

Postby Flint1b » July 28th, 2020, 9:49 pm

For the reference, when I run Paths of Glory 9.8 on Vassal 3.3.2:
- start wizard, select "new game", then "deluxe map something blabla", then it loads for ~33 seconds until I can continue
- then continue (next/finish, whichever works)
- then the Player starts loading and loads for about 2:20min until it finishes loading and the CPU usage goes down

All this time, the CPU usage is often below 80% on one core, and almost no CPU usage on the other 3 cores. Rarely, it goes to 100% on a single core, even more rare is when 2 cores are used up to 100%. And that is not due to I/O, there's hardly any I/O happening during this time.

As a comparison, when I load up Minecraft all 4 CPU cores go up to almost 100% until it's finished loading.

This must be the result of glorious single-thread processing in the AWT event thread, and a model that processes complex things in a recursive manner. I took a look at how these global key thingies work, it's all recursive, I see no way of turning that into parallel processing to make use of all CPU cores.

The doctor suggests slaughtering this thing, taking out whatever parts are useful, and recycling them within a rewrite, in Java, with JavaFX. And including the old code into the new one and offering a "legacy mode" for the modules whose developers are too lazy to adapt modules to new version :D
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Am I doing this right?

Postby Flint1b » July 29th, 2020, 2:32 am

Cattlesquat wrote:But anyway, Flint1b -- now drill down on those modules under YOUR branch and see if you can speed up Global Key Commands themselves!


There's also a discussion in that PR now, I'm not sure it will get merged at all, almost wishing I wouldn't have gotten involved with a change that someone else came up with which sounded really good and I just went ahead and implemented it without fully understanding the consequences.

Anyways for my potato of a computer this change makes a huge difference and if it doesn't get in, I will just make a custom version of Vassal for myself and use that instead of the release build. Further discussions about the PR and probably all performance optimizations in general, I give up, whoever wants it merged can take over. I'm going back into "rogue mode", find some useful TODOs on my own and make the necessary changes.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: Am I doing this right?

Postby uckelman » July 30th, 2020, 1:14 am

Thus spake Flint1b:
> For the reference, when I run Paths of Glory 9.8 on Vassal 3.3.2:
> - start wizard, select "new game", then "deluxe map something blabla",
> then it loads for ~33 seconds until I can continue
> - then continue (next/finish, whichever works)
> - then the Player starts loading and loads for about 2:20min until it
> finishes loading and the CPU usage goes down

I had a look in visualvm at why things seemed so slow _after_ the module
loaded.

What I found was 42% of the time was being spent in
BasicModule.encodeSubCommand() while I was doing things like removing
then Neutral Country markers, so I checked there.

private String encodeSubCommand(Command c) {
String s = null;
for (int i = 0; i < commandEncoders.length && s == null; ++i) {
s = commandEncoders[i].encode(c);
}
return s;
}

If the profiling is right, we're spending _ages_ just looping over
these command encoders... Hmm.

--
J.
User avatar
uckelman
Site Admin
 
Posts: 9014
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Am I doing this right?

Postby uckelman » July 30th, 2020, 1:19 am

Thus spake Joel Uckelman:
> Thus spake Flint1b:
> > For the reference, when I run Paths of Glory 9.8 on Vassal 3.3.2:
> > - start wizard, select "new game", then "deluxe map something blabla",
> > then it loads for ~33 seconds until I can continue
> > - then continue (next/finish, whichever works)
> > - then the Player starts loading and loads for about 2:20min until it
> > finishes loading and the CPU usage goes down
>
> I had a look in visualvm at why things seemed so slow _after_ the module
> loaded.
>
> What I found was 42% of the time was being spent in
> BasicModule.encodeSubCommand() while I was doing things like removing
> then Neutral Country markers, so I checked there.
>
> private String encodeSubCommand(Command c) {
> String s = null;
> for (int i = 0; i < commandEncoders.length && s == null; ++i) {
> s = commandEncoders[i].encode(c);
> }
> return s;
> }
>
> If the profiling is right, we're spending _ages_ just looping over
> these command encoders... Hmm.

And also GlobalProperty.encode() was called about 15k times.

--
J.
User avatar
uckelman
Site Admin
 
Posts: 9014
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Next

Return to Developers

Who is online

Users browsing this forum: No registered users and 4 guests