aes-js
aes-js copied to clipboard
Huge performance boost by reducing operations with arrays
Hi.
Script works about 2.2 times faster, If replace arrays ("a" and "t") in ecrypt/decrypt with int32 numbers. Another 5% speed boost if delete convertToInt32 from this functions.
I performed some tests with 1000 runs of encryption 1MB data:
- Original JS file.
- After first commit.
- After second commit.

Last commit brings another 5% performance boost.
I did some tests with changes like #64, but i didn't notice any speed up.

Hello, this is a big improvement ! I tested it on production and it worked perfectly. Thank you very much !
Works 1.8x faster for me now. Amazing!
The docs need to be updated, as it now requires things to be Uint8Arrays, but can you compare against the typescript branch? It's available in npm with the beta tag.
(the typescript branch is also designed to be backwards-compatibility breaking and allows for features in ES6 and beyond, while the older version is planned to continue targeting ES3 environments)
(also note that segment size is now provided in bit-width; only byte-aligned segment sizes are currently supported, but that will change in the future)
The docs need to be updated, as it now requires things to be Uint8Arrays, but can you compare against the
typescriptbranch? It's available in npm with thebetatag.
But current version already work only with Uint8Arrays as stated in Readme?
Although I should use
createArray(roundKeyCount) instead of new Array(roundKeyCount)
Hey, any news here? The update is great, it makes the package much faster, so it makes no sense to use code before the update. And everyone that wants the improvment has to hardcode the fork, instead of using npm. The pull request is here for almost 2 years. How about to merge it already?
@ricmoo @NikitaCartes
Is that compared to the typescript branch? It’s been used in production for some time now and should be moved out of beta and made latest.
Thanks for the bump to look back into this.
Current PR is based on main js branch. But it should be easy to convert it to typescript.
Once you release the TS update, I could help with this PR (unless @NikitaCartes don't wanna do it)
I think I can do it when I will have some free time
I’ll try getting the TypeScript branch merged this week. And put together some quick performance profiling.
Thank you!