Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MEKHQ hangs on start-up, could not find "x" unit from "y" rat
#41
RAT files complexity multiplied by the code to load them complexity.

We can't really do anything about the former, but the latter are an issue to solve, yes.
Reply
#42
Ok, I analysed it a bit further.

First, there are over 40 thousand RAT files in there. Putting them all into one big fat ZIP file and reading from that already dropped down the load time from about 65 seconds to 6 seconds (that's from an SSD, so file load times shouldn't even matter!).

Replacing Scanner with BufferedReader further reduced the load time to 4 seconds. This time, since it's just one small ZIP file being read, it shouldn't even matter where you read it from.

I'll profile a bit further, but it looks like we will be able to do with RATs what we already do with units and pack them all together into one ZIP file for distribution.

EDIT: Code done, https://github.com/MegaMek/megamek/pull/90 - I can reliably get 4s load times if I pack all the subdirectories in "data/rat" into one ZIP file and delete them (else it duplicates the RAT entries).
Reply
#43
Good job Akjosch, please don't ever get burnt out.  So, if I just go in and zip up all my RATs it will speed things up or did you have to change the code for that?
Reply
#44
(03-21-2016, 09:17 AM)BLOODWOLF link Wrote: Good job Akjosch, please don't ever get burnt out.  So, if I just go in and zip up all my RATs it will speed things up or did you have to change the code for that?

I had to change the code (in MegaMek) for that. If you know how to do it, grab the current code for it, apply the two patches in my PR on top of it, compile your own MegaMek.jar and replace the one in MekHQ directory with it.

Else you'll have to wait for the next release, assuming there are no major problems which would prevent from including my patches to it. No idea when that'll be.
Reply
#45
I can test this on one of my older machines. Single core AMD Ahtlon 3000 4GB ram on a rather old IDE HD. Just need to find a moment to plug it back up and copy a new build over. However long that'll take...
Reply
#46
I'd love to test this as well but....dont know how to compile a .jar?  Put the source code into a folder and then paste the two patches into it and let them overwrite?  Im at work so, I cant try this yet. 
Reply
#47
What OS are you using, I can compile it and post a copy to my dropbox for you.
Reply
#48
Windows 8.1 y'all are awesome!
Reply
#49
Here's one I tested. Version 0.41.15 with "cherry-picked" patch.

Code:
RAT files loaded
The unit Truck (AC Conversion) could not be found in the CivilianUnits RAT (rat.zip:Against The Bot/CivilianUnits.txt)
The unit Truck (SRM Conversion) could not be found in the CivilianUnits RAT (rat.zip:Against The Bot/CivilianUnits.txt)
The unit Truck (AC Conversion) could not be found in the CivilianUnits_CivVeh RAT (rat.zip:Against The Bot/CivilianUnits_CivVeh.txt)
The unit Truck (SRM Conversion) could not be found in the CivilianUnits_CivVeh RAT (rat.zip:Against The Bot/CivilianUnits_CivVeh.txt)
Loaded Rats in: 2690ms.

That's with all the 40 thousand RAT files put into a single "rat.zip" and off an SSD, so pretty much the only thing limiting the speed is the CPU and memory.


Attached Files
.zip   MegaMek.zip (Size: 4.64 MB / Downloads: 2)
Reply
#50
Awesome will try this when I get home.
Reply
#51
Do you foresee the code change causing any issues with something specific that I should focus on testing other than load time?  Or was it just a change in how it looks up/loads the RATs?
Reply
#52
(03-22-2016, 09:51 AM)BLOODWOLF link Wrote: Do you foresee the code change causing any issues with something specific that I should focus on testing other than load time?  Or was it just a change in how it looks up/loads the RATs?

I specifically only included the RAT loading change.
Reply
#53
Here is a full build for the current MM
https://www.dropbox.com/s/f7x78her2q99g0...s.zip?dl=0

It's actually smaller now that the rats are zipped.
If you want to compare load times create two MM directories and unzip the rats.zip in one then check the logs for the timing.
Reply
#54
MekHQ log: Loaded Rats in: 404228ms.

Do I need to zip up my RATs for it to work?

Ok, ty phoenix.


Attached Files
.txt   mekhqlog.txt (Size: 25.9 KB / Downloads: 0)
Reply
#55
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: megamek.common.verifier.EntityVerifier.<init>(Ljava/io/FileWinkV

Did I do something wrong?  I extracted the files and then started up HQ and still took 400,000ms so, seen that you had all the RATs zipped up and that it was looking under the default.zip/(X Rat) files so, recycled all the unzipped RATs that come stock with HQ and now I get this :\ guess I will put them back in.

EDIT: scratch that it worked, loaded in 9 sec all except for the exception so, having doubles of the RATs I dont think was an issue.....


Attached Files
.cpnx   AFFS-FSACRCT-2REG-2BN-ECO30280201.cpnx (Size: 846.23 KB / Downloads: 1)
.txt   mekhqlog.txt (Size: 27.61 KB / Downloads: 1)
Reply
#56
So for me, zipped Loaded Rats in: 6569ms.
Unzipped Loaded Rats in: 144418ms.

New changes cut loading time in half for me.
Reply
#57
........right mine loaded in 9sec but, threw up that exception and then closed wouldn't load the game.
Reply
#58
(03-22-2016, 09:16 PM)BLOODWOLF link Wrote: Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: megamek.common.verifier.EntityVerifier.<init>(Ljava/io/FileWinkV

The code in EntityVerifier changed and MekHQ code was changed to follow, and so you need a full new MekHQ update if you pull the current MegaMek code to build that MegaMek.jar file.

That's why I "cherry-picked" just the RAT loading code for the version I uploaded above.
Reply
#59
Um, ok megamek does load faster now with the .jar file you made.  HQ still "Loaded Rats in: 419186ms".  But, if its fixed for the next release I will be patient and wait because I dont know.....but thank you very much.
[img][/img]
Reply
#60
(03-23-2016, 01:10 AM)BLOODWOLF link Wrote: Um, ok megamek does load faster now with the .jar file you made.  HQ still "Loaded Rats in: 419186ms".  But, if its fixed for the next release I will be patient and wait because I dont know.....but thank you very much.

Did you zip up your RATs in MekHQ, too?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mac OSX: Can't find file/directory askindred 2 412 06-22-2019, 07:59 PM
Last Post: askindred
  MekHQ Marketplace Unit List Blank blackcatf 0 208 02-16-2019, 04:53 PM
Last Post: blackcatf
  MekHQ 0.3.21 will not start MagnusEffect 4 1,297 01-17-2016, 03:04 AM
Last Post: MagnusEffect
  Hangs Loading Units (unplayable) just1chancefree 27 5,829 05-15-2013, 11:07 PM
Last Post: Xenon54z
  Cannot find stock mechs Madcow9000 3 1,483 10-21-2012, 05:19 PM
Last Post: ralgith

Forum Jump:


Users browsing this thread: 3 Guest(s)