Skip to content

Optimize JSI to ByteBuffer conversion in RevocationRegistry#8

Merged
berendsliedrecht merged 2 commits intoanoncreds:mainfrom
AhmedFatthy1040:fix-176-bytebuffer-optimization
Apr 18, 2025
Merged

Optimize JSI to ByteBuffer conversion in RevocationRegistry#8
berendsliedrecht merged 2 commits intoanoncreds:mainfrom
AhmedFatthy1040:fix-176-bytebuffer-optimization

Conversation

@AhmedFatthy1040
Copy link
Contributor

Added direct JSI to ByteBuffer conversion by implementing jsiToValue<ByteBuffer>, eliminating the intermediate string conversion step. Applied this optimization to revocationRegistryFromJson as specified in issue anoncreds/anoncreds-rs#176. This makes the code cleaner and more efficient by reducing unnecessary memory allocations.

…ate string step

Signed-off-by: AhmedFatthy1040 <eltonsy1040@outlook.sa>
@swcurran
Copy link
Contributor

@andrewwhitehead — can you please take a look and approve? Looks fine to me, but I’m not knowledgeable enough in the code.

@swcurran
Copy link
Contributor

Actually, it should be @berendsliedrecht or @TimoGlastra that takes a look, pretty please.

@swcurran swcurran requested review from TimoGlastra and genaris April 16, 2025 13:56
Copy link
Contributor

@berendsliedrecht berendsliedrecht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been tested in the React Native example app? Can you add a screenshot?

@AhmedFatthy1040
Copy link
Contributor Author

AhmedFatthy1040 commented Apr 17, 2025

@swcurran @berendsliedrecht Thanks for your review! I actually built the code, and it compiled successfully without any errors. I tried the React Native example as you suggested, but I noticed that it only uses anoncreds.version(). So I'm not sure if that's enough to properly test the revocationRegistryFromJson function.

Here are the screenshots:
Screenshot (83)
Screenshot (82)

@berendsliedrecht
Copy link
Contributor

@AhmedFatthy1040 Thanks! Did you check all the places where it could be replaced? Or was it only the revregdeffromjson?

Re the version 0.2.0, thats fine. It is mainly a test to see that everything compiled correctly.

Signed-off-by: AhmedFatthy1040 <eltonsy1040@outlook.sa>
@AhmedFatthy1040 AhmedFatthy1040 force-pushed the fix-176-bytebuffer-optimization branch from 532055d to aea1db7 Compare April 17, 2025 14:49
@AhmedFatthy1040
Copy link
Contributor Author

AhmedFatthy1040 commented Apr 17, 2025

@berendsliedrecht I've now checked all the functions in similar situations and handled them as well. After making the changes, I tested the app and it compiled successfully.

@berendsliedrecht
Copy link
Contributor

Thanks for the PR @AhmedFatthy1040

@berendsliedrecht berendsliedrecht merged commit 2d542db into anoncreds:main Apr 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants