plugins-workspace
plugins-workspace copied to clipboard
Stronghold.load() is slow
In my JS code, I run the following code:
appDataDir()
.then(async dir => {
console.log(dir)
const vaultPath = `${dir}/vault.hold`;
const vaultPassword = 'vault_password';
const stronghold = await Stronghold.load(vaultPath, vaultPassword);
console.log("TEST");
})
The time between the first and second log is always somewhere between 1 and 2 minutes. Is there a reason why Stronghold.load() is so slow for me?
Nevermind. I'm still not sure what the issue was, but clearing the app's storage, though I had already tried that before, solved the issue for now.
Apparently, it only becomes slow after saving a value.
I'm having trouble with the underlying iota_stronghold being slow as well. Also typically between 1-2 minutes.
In case anyone else is struggling with this, I was able to get the underlying iota_stronghold working smoothly by downgrading the version to 1.0.5.
I also have this issue.
It seems that it is only slow for me in debug target, but not release. Is this also the case for you?
@gabriel-le Yes, it's the same here.
I went into IOTA's discord and found someone raising up the same issue, one of the members asked to run the program in --release mode, which does makes it faster. But didn't provide any other details
I went into IOTA's discord and found someone raising up the same issue, one of the members asked to run the program in --release mode, which does makes it faster. But didn't provide any other details
yes in release mode it's faster.
Running in release mode does make things a bit more inconvenient.
Just as a workaround, I created a simple class with getKey, setKey and removeKey methods. Using env variables to check if I'm in DEV or PROD if in DEV I use localStorage just to quickly test without having to wait, and only in PROD will be using stronghold.
Running in release mode does make things a bit more inconvenient.
Just as a workaround, I created a simple class with getKey, setKey and removeKey methods. Using env variables to check if I'm in
DEVorPRODif in DEV I use localStorage just to quickly test without having to wait, and only in PROD will be using stronghold.
yes, this is very neat.
i'm facing the same issue it works fine in release mode but too slow in development mode using @Ripwords method seems to be a temporary fix to help focus on other things
I am facing the same issue too, too slow in development mode
I also noticed something strange, the memory keeps increasing by factor of 20-30 MB, about 16 times (480mb) : everytime i called the load method.
I also noticed something strange, the memory keeps increasing by factor of 20-30 MB, about 16 times (480mb) : everytime i called the load method.
@endrik-exe is this in dev mode or prod mode? If prod I will need to remove it from my project.
@HuakunShen This is dev mode, haven't tested it in prod yet.
Does anyone know what the underlying problem is? Since this was tagged as upstream, I checked the issues on the stronghold.rs repo, but couldn't find anything related.
I've confirmed that this issue occurs only in debug mode, everything works fine in release. While it's just speculation, the root cause may be related to unoptimized cryptographic operations (encryption/decryption). Given that both the load() and save() methods are affected, this seems like a reasonable assumption. The thing is that this impacts negatively the development experience.
Issue seems to be with the scrypt crate, which is a dependency of iota-crypto. Try adding this to Cargo.toml
[profile.dev.package.scrypt]
opt-level = 3
Issue seems to be with the
scryptcrate, which is a dependency ofiota-crypto. Try adding this toCargo.toml[profile.dev.package.scrypt] opt-level = 3
Works for my too!