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

feat: make getCells synchronous #1450

Merged

Conversation

AyushAgrawal-A2
Copy link
Collaborator

@AyushAgrawal-A2 AyushAgrawal-A2 commented Jun 23, 2024

related to #1447
closes #1409
closes #1114

This pr is meant to explore usage of Atomics and SharedArrayBuffer, for communication between workers.
Using this we can block(sleep) a worker thread and execute synchronously, instead of using async / await

Pros:

Cons:

  • Overhead due to encoding and decoding from shared memory.
  • To use SharedArrayBuffer, we need to meet the Security requirements.
    • For local dev - Chrome treats localhost / 127.0.0.1 as secure context. COOP, COEP headers are added in vite.config.js. So everything works without switching to https.
    • For deployment - It will require all deployment to be secure and for quadratic-client we need to add headers mentioned in Security requirements.

@cla-bot cla-bot bot added the cla-signed label Jun 23, 2024
Copy link

vercel bot commented Jun 23, 2024

@AyushAgrawal-A2 is attempting to deploy a commit to the Quadratic Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Jun 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quadratic ✅ Ready (Inspect) Visit Preview Jun 24, 2024 1:02pm

@AyushAgrawal-A2 AyushAgrawal-A2 force-pushed the ayush/try-atomics branch 2 times, most recently from f167f1f to d1583c7 Compare June 28, 2024 16:23
@davidfig
Copy link
Collaborator

davidfig commented Jul 1, 2024

This works great. Outside of the necessary server changes, is there anything else that makes this a POC and not ready for review? We'll also need this ported to JS so we can remove the await requirement there as well.

@AyushAgrawal-A2 AyushAgrawal-A2 changed the title poc: make getCells synchronous (experimenting with atomics) feat: make getCells synchronous Jul 2, 2024
@AyushAgrawal-A2
Copy link
Collaborator Author

@davidfig
ready for review

@davidfig
Copy link
Collaborator

davidfig commented Jul 2, 2024

Awesome. Works wonderfully.

@davidfig
Copy link
Collaborator

Please resolve conflicts (hopefully last one)

@AyushAgrawal-A2
Copy link
Collaborator Author

Please resolve conflicts (hopefully last one)

@davidfig
done

Copy link

codecov bot commented Jul 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.78%. Comparing base (f1e0702) to head (cb99c96).
Report is 516 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1450      +/-   ##
==========================================
- Coverage   90.92%   89.78%   -1.14%     
==========================================
  Files         180      185       +5     
  Lines       34169    34763     +594     
==========================================
+ Hits        31067    31211     +144     
- Misses       3102     3552     +450     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidkircos davidkircos changed the base branch from main to test-make-cells-async July 22, 2024 21:01
@davidkircos davidkircos merged commit c7b8d4c into quadratichq:test-make-cells-async Jul 22, 2024
8 of 12 checks passed
@davidkircos davidkircos mentioned this pull request Jul 22, 2024
3 tasks
@AyushAgrawal-A2 AyushAgrawal-A2 deleted the ayush/try-atomics branch July 22, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dev: improve how c, cells work error 'await' outside async function for functions with cell in them
3 participants