Skip to content
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

Very long load times between scene changes #2038

Closed
fat-lobyte opened this issue Dec 26, 2018 · 5 comments
Closed

Very long load times between scene changes #2038

fat-lobyte opened this issue Dec 26, 2018 · 5 comments
Labels

Comments

@fat-lobyte
Copy link

Hey there!

I am using KSP 1.3.1 with RealismOverhaul, Realist Progression 0, RSS and a bunch of other mods with Principia 2018120707-Erdős-0-g3e2334a95bcfc6869b5464ecda5ae48b5412dba0 .

Unfortunately, my Scene load times seem extremely long.
Without principia, a scene change takes 10 - 15 seconds.
With 2018081110-Desargues, every scene load took at least 1:30 minutes.
With 2018120707-Erdős, this became even worse. Now every scene change takes 3 minutes!!

During that time, the Memory usage drops quickly by 2-3 Gb and then slowly builds up these 2-3 Gb until the scene change completes.

My savegame has about 36 vessels, and the save file has a size of 10 mb.
Is this to be expected with principia? I know 1-3 minutes doesn't seem like much, but it seriously disrupts the gameplay.

Is this a bug? Is there a workaround for this?

@eggrobin
Copy link
Member

In order to investigate an issues about saves being slow to load (the slow thing that happens during scene changes is save loading), we need your save.

We will need both of them: the one that took 1.5 min with Desargues, and the one that took 3 min with Erdős.

@eggrobin eggrobin changed the title Very long load times between Scene Cchanges Very long load times between scene changes Dec 27, 2018
@fat-lobyte
Copy link
Author

fat-lobyte commented Dec 27, 2018

As requested: Save files, I also added the respective INFO log file.

Note that I took the save file from desargues and just used it for erdos .

2038-long-load_erdos.zip
2038-long-load_desargues.zip

Here's the section from the respective logs:

I1227 18:28:04.885013  3592 interface.cpp:820] principia.ksp_plugin_adapter.PrincipiaPluginAdapter.OnAwake()
I1227 18:28:04.934020  3592 interface.cpp:371] Destroying Principia plugin
I1227 18:28:04.934020  3592 interface.cpp:377] Plugin destroyed
I1227 18:28:04.934020  3592 interface.cpp:820] Serialization has 29 chunks
I1227 18:28:04.934020  3592 interface.cpp:423] Begin plugin deserialization
I1227 18:28:04.950019  3592 interface.cpp:445] End plugin deserialization
I1227 18:28:04.957020 12180 plugin.cpp:1260] principia::ksp_plugin::internal_plugin::Plugin::ReadFromMessage
I1227 18:33:31.327248  3592 interface.cpp:904] Begin plugin serialization
I1227 18:33:31.327248  3592 plugin.cpp:1186] principia::ksp_plugin::internal_plugin::Plugin::WriteToMessage
I1227 18:33:31.335247  3592 ephemeris_body.hpp:716] principia::physics::internal_ephemeris::Ephemeris<struct principia::geometry::internal_frame::Frame<enum principia::serialization::Frame_PluginTag,7,1> >::WriteToMessage
I1227 18:33:31.340250  3592 ephemeris_body.hpp:744] message->SpaceUsed(): 4945952
I1227 18:33:31.345247  3592 ephemeris_body.hpp:745] message->ByteSize(): 757315
I1227 18:33:31.379249  3592 interface.cpp:921] End plugin serialization

Look at the gap between"principia::ksp_plugin::internal_plugin::Plugin::ReadFromMessage Begin plugin serialization. Is this normal?

I also tried turning up the verbosity level, but that completely locked KSP during scene load for a long time, writing Gigabytes and Gigabytes of messages like this:

I1227 18:33:45.149060 8648 continuous_trajectory_body.hpp:432] Using degree 10 for 000000011AB5BE40 with error estimate +7.31249374048082335e-04 m

@pleroy
Copy link
Member

pleroy commented Dec 30, 2018

Well, this is embarrassing. I suspect that at some point in the past you extended either the flight plan or the prediction of a vessel very far in the future (to year 2051). While all the flight plans and predictions in the save are very short (ending some time in 1978), when a save gets restored Principia wants to extend the solar system up to year 2051, the maximum time ever reached. This computation takes 3-4 minutes on my machine.

The fix is kind-of obvious: the solar system should not be recomputed up to year 2051 when there is no need to do so. Unfortunately we are somewhat nervous that this could break internal invariants. So no guarantee that we'll be able to fix it in the upcoming Εὔδοξος release, it may have to wait until the February release.

The speed difference between Desargues and Erdős comes from the fact that in Erdős we have added a complex geopotential to the Earth. This makes computations a bit more expensive, but it's not observable in normal game situations. Of course, if your game freezes for an extra 2 minutes, that's definitely observable.

@fat-lobyte
Copy link
Author

Good to know that you found the culprit!

In the mean time, is there any way I can "rescue" my save? I've put my RSS/RO playthrough on hold because a 3 minute wait is quite disruptive.

@pleroy
Copy link
Member

pleroy commented Jan 1, 2019

There is nothing that you can do to patch your save: not only is the encoding complicated, but a code change is needed in Principia to fix the bug. Don't throw the save away, though: the fix will be backward compatible and will rewrite the save. The first time you load it it will be slow, after that it will take around 10-20 seconds to switch scenes.

If all goes well (including in-game testing) the fix will be in Εὔδοξος to be released on Jan 6th.

@pleroy pleroy added this to the Εὔδοξος milestone Jan 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants