Slow program closing - patch proposal

A. K.
2013-09-21
2013-09-22
  • A. K.

    A. K. - 2013-09-21

    Currently, I'm using KeePass 2.23 on a relatively slow machine (netbook). The problem is, that program hangs for about 10s when I'm trying to close process completely. I analyzed shutdown procedure and found, that the most time-consuming operation is instantiating a XmlSerializer object, which is done in XmlSerializerEx.Deserialize() to save config. The XmlSerializer object can be reused and there is no need to create it each time the method XmlSerializerEx.Deserialize() is invoked, as type of deserializer is always the same. Therefore, I changed the class:

    1) created new private property

    private XmlSerializer xs;
    

    2) instantiate xs object once, in class constructor:

    xs = new XmlSerializer(m_t);
    

    3) In the end of Deserialize() method just use

    return xs.Deserialize(s);
    

    without creating new object.

    Now, the closing procedure is much faster.

     
  • Dominik Reichl

    Dominik Reichl - 2013-09-21

    KeePass only instantiates XmlSerializerEx objects for the types AppConfigEx and KPTranslation. For both of these, explicit deserialization code exists, i.e. the code you mentioned is never called (and thus cannot influence the shutdown performance), at least not without a plugin.

    Best regards,
    Dominik

     
  • A. K.

    A. K. - 2013-09-22

    Strange. In my configuration, when putting breakpoint on this method it was invoked and resulted in a noticeable delay. I started program setup from scratch without addons and now it works without this method.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks