Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance(sqlcipher): Fix burn_stack performance issue #3470

Merged
merged 1 commit into from
May 12, 2023

Conversation

alexjba
Copy link
Contributor

@alexjba alexjba commented May 10, 2023

Second iteration of #3464

  1. Added changes in the newly forked go-sqlcipher repo
  2. Update go.mod to use new go-sqlcipher version

Fixing status-im/status-desktop#10572

Implements a cross-platform version of OP-TEE/optee_os#3102

  1. Remove recursion
  2. Use memset instead of while loop

A description to understand introduced changes without reading the code.

zeromem weights about 50% of the total CPU time on M1 Macs and seems to be major performance offender.
It is used to clear the stack when using variables with sensitive information.

Perf improvement on Status desktop (M1 arch):
develop on lower left; This branch on upper right

Screen.Recording.2023-05-08.at.14.28.45.mov

Profiling data with app in idle:
Before
Screenshot 2023-05-08 at 14 52 31

After
Screenshot 2023-05-08 at 14 49 07

Implements a cross-platform version of OP-TEE/optee_os#3102

1. Remove recursion
2. Use memset instead of while loop
@ghost
Copy link

ghost commented May 10, 2023

Pull Request Checklist

  • Have you updated the documentation, if impacted (e.g. docs.status.im)?
  • Have you tested changes with mobile?
  • Have you tested changes with desktop?

@status-im-auto
Copy link
Member

status-im-auto commented May 10, 2023

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 99571e6 #1 2023-05-10 10:38:39 ~2 min linux 📦zip
✔️ 99571e6 #1 2023-05-10 10:40:19 ~4 min ios 📦zip
✔️ 99571e6 #1 2023-05-10 10:41:15 ~5 min android 📦aar
✔️ 99571e6 #1 2023-05-10 10:49:25 ~13 min tests 📄log

Copy link
Contributor

@osmaczko osmaczko left a comment

Choose a reason for hiding this comment

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

Nice work 👏

Copy link
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

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

Very nice!

@caybro
Copy link
Member

caybro commented May 10, 2023

Someone needs to test this, ideally on mac/linux/windows x intel/m1/arm CPUs

@alexjba alexjba merged commit ac83736 into develop May 12, 2023
@alexjba alexjba deleted the fix/burn_stack-perf-issue branch May 12, 2023 06:08
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.

7 participants