Giter VIP home page Giter VIP logo

Comments (5)

keepassium avatar keepassium commented on July 24, 2024

Dumping the prettyfied XML structure seems to clock in at around 18MB. This does not seem that much for the database itself objectively but it seems this is already too much, as autofill just dies silently.

I agree, such an XML this should not be too big of a deal. Dying silently means running out of memory at XML parsing or processing stage.

As much as I would love to skip custom icons and attachments while loading in AutoFill, this is quite problematic. Due to an early design mistake, KeePassium uses a DOM parser (which loads the whole XML tree to memory), rather than an event-based SAX parser (which parses XML in small chunks and can make decisions during the process). To my defense, at the time of this decision AutoFill was not even announced, so memory consumption was not that important.

Well, now memory became important, but optimization requires rewriting the whole database processing code. Which is a large all-or-nothing task that cannot be done incrementally. It is indeed on the list, but there is always something more urgent…

</rant>

there are some 300+kB favicons in there which is ridiculous.

This might be the reason.

When adding larger favicons, KeePassium specifically downsizes them to 128x128 PNG. But when showing the existing ones, resizing is done only in UI. Which means, according to this post, that the original image, in full resolution and colors, is decompressed to memory for displaying. I guess a 300 kB compressed PNG turns into quite a heavy bitmap…

(By the way, were the large favicons added by KeePassium? If so, there is probably a separate issue in the downsizing code.)

from keepassium.

ixs avatar ixs commented on July 24, 2024

I agree, such an XML this should not be too big of a deal. Dying silently means running out of memory at XML parsing or processing stage.

Thank you for confirming. This was my understanding as well.

As much as I would love to skip custom icons and attachments while loading in AutoFill, this is quite problematic. Due to an early design mistake, KeePassium uses a DOM parser (which loads the whole XML tree to memory), rather than an event-based SAX parser (which parses XML in small chunks and can make decisions during the process). To my defense, at the time of this decision AutoFill was not even announced, so memory consumption was not that important.

Right. DOM Parser seems like a sensible choice. If there were no memory pressure. Which there now unfortunately is. Bummer.

Well, now memory became important, but optimization requires rewriting the whole database processing code. Which is a large all-or-nothing task that cannot be done incrementally. It is indeed on the list, but there is always something more urgent…

Of course. But hey, easter is coming up, what better time to relax, ponder past sins and rewrite such code?! 😆

there are some 300+kB favicons in there which is ridiculous.

This might be the reason.

When adding larger favicons, KeePassium specifically downsizes them to 128x128 PNG. But when showing the existing ones, resizing is done only in UI. Which means, according to this post, that the original image, in full resolution and colors, is decompressed to memory for displaying. I guess a 300 kB compressed PNG turns into quite a heavy bitmap…

Interesting. Just read that post and if that's the case that would indeed explain the problem I'm seeing.

(By the way, were the large favicons added by KeePassium? If so, there is probably a separate issue in the downsizing code.)

I am not certain. I've been using KeepassXC and KeePassium in parallel and do not remember exactly, which icons were added where.

When I was looking for testcases for large icons in my database, I noticed a weird thing though:
The large icons in my db are all icons with 384 x 384px resolution.
But the source websites only offer smaller icons:

So it looks like something is actually saving the icons in a larger format than needed? Could that someone be KeePassium?

from keepassium.

keepassium avatar keepassium commented on July 24, 2024

Could that someone be KeePassium?

Guess what, you are absolutely right! KeePassium successfully "downscales" 180x180px icons into 128x128pt, which happens to be 384x384px on modern devices :) I've created a separate issue for that: #354

from keepassium.

keepassium avatar keepassium commented on July 24, 2024

Of course. But hey, easter is coming up, what better time to relax, ponder past sins and rewrite such code?! 😆

See, there is always something smaller and more urgent :)

from keepassium.

ixs avatar ixs commented on July 24, 2024

See, there is always something smaller and more urgent :)

🤯

I wiped the 384x384px icons from the database.
Database is now back down to about 1MB and Autofill is not dying anymore with that size.
So I guess this is a win? 😆

Of course, the overall problem is still unsolved, autofill should not be dying over icons...

from keepassium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.