FractalUK/KSPInterstellar — pull request #66 by williamh42 (2014-11-14 04:09:32+00:00)
Title: Fix for PluginHelper.hasTech() performance

The hasTech() function reloads and parses the entire persistent file from disk every
time - I noticed this because attaching radiators to my ships in a mid-career game was getting slow, especially if I was radially attaching multiple radiators - 8x symmetry caused nearly a full second pause.

The problem is actually worse than that, it causes a pause anytime an upgrade-able part is selected in the editor, and believe silenty causes a load delay anytime a ship is loaded (to check if parts can be upgraded) - for a ship with many radiators it could be a significant delay!

This quick hack changes it to only load acquired techs once and
clears them if called in a different scene or when returning to the
space center. I only briefly tested it to be sure there aren't any cases that it fails to reload the tech tree, but personally the performance is worth it even if it does.

Ideally there should (I would hope?) be a way to directly access the in-memory tree without messing with the persistant file but I only recently looked at modding (to fix this annoying bug in your otherwise awesome mod) so I don't know it either....