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

fix(compiler): equality and external libraries bugs in simulator #5554

Merged
merged 31 commits into from
Mar 6, 2024

Conversation

Chriscbr
Copy link
Contributor

@Chriscbr Chriscbr commented Jan 26, 2024

This pull request fixes a range of funky JavaScript issues we've had running inflight code in the Wing simulator by switching internally from running JS code in a vm to running JS code using Node.js child processes.

The main issues with vm are:

Fixes #1980
Fixes #4131
Fixes #4118
Fixes #4792

Closes #4725

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

@monadabot
Copy link
Contributor

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistence, don't hesitate to ping the relevant owner over Slack.

Topic Owner
Wing SDK and utility APIs @chriscbr
Wing Console @ainvoner, @skyrpex, @polamoros
JSON, structs, primitives and collections @hasanaburayyan
Platforms and plugins @hasanaburayyan
Frontend resources (website, react, etc) @tsuf239
Language design @eladb
VSCode extension and language server @markmcculloh
Compiler architecture, inflights, lifting @yoav-steinberg
Wing Testing Framework @tsuf239
Wing CLI @markmcculloh
Build system, dev environment, releases @markmcculloh
Library Ecosystem @chriscbr
Documentation @hasanaburayyan
SDK test suite @tsuf239
Examples @skorfmann
Wing Playground @eladcon

@Chriscbr Chriscbr changed the title fix(compiler): equality and external libraries work incorrectly in simulator fix(compiler): equality and external libraries bugs in simulator Jan 26, 2024
@monadabot
Copy link
Contributor

monadabot commented Jan 26, 2024

Console preview environment is available at https://wing-console-pr-5554.fly.dev 🚀

Last Updated (UTC) 2024-03-06 20:39

@monadabot
Copy link
Contributor

monadabot commented Jan 26, 2024

Benchmarks

Comparison to Baseline ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 58ms±0.48 59ms±0.73 +1ms (+1.29%)⬜
functions_1.test.w -t sim 532ms±18.37 534ms±18.06 +2ms (+0.3%)⬜
functions_1.test.w -t tf-aws 949ms±6.07 956ms±8.85 +7ms (+0.76%)⬜
jsii_small.test.w -t sim 498ms±3.6 492ms±3.78 -5ms (-1.07%)⬜
jsii_small.test.w -t tf-aws 718ms±5.9 721ms±13.16 +2ms (+0.31%)⬜
jsii_big.test.w -t sim 2915ms±15.17 2917ms±6.91 +2ms (+0.07%)⬜
jsii_big.test.w -t tf-aws 3124ms±10 3103ms±10.84 -21ms (-0.67%)⬜
hello_world.test.w -t sim 520ms±4.99 523ms±6.63 +4ms (+0.68%)⬜
hello_world.test.w -t tf-aws 1646ms±8.2 1651ms±14.39 +5ms (+0.3%)⬜
empty.test.w -t sim 490ms±3.5 489ms±4.57 -1ms (-0.21%)⬜
empty.test.w -t tf-aws 708ms±4.62 702ms±2.69 -5ms (-0.75%)⬜
functions_10.test.w -t sim 593ms±12.19 594ms±5.76 +1ms (+0.15%)⬜
functions_10.test.w -t tf-aws 2313ms±13.25 2311ms±9.06 -2ms (-0.09%)⬜

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 59ms 58ms 61ms 1ms 1ms
functions_1.test.w -t sim 534ms 517ms 602ms 18ms 25ms
functions_1.test.w -t tf-aws 956ms 939ms 977ms 9ms 12ms
jsii_small.test.w -t sim 492ms 487ms 506ms 4ms 5ms
jsii_small.test.w -t tf-aws 721ms 704ms 769ms 13ms 18ms
jsii_big.test.w -t sim 2917ms 2904ms 2931ms 7ms 10ms
jsii_big.test.w -t tf-aws 3103ms 3075ms 3125ms 11ms 15ms
hello_world.test.w -t sim 523ms 507ms 535ms 7ms 9ms
hello_world.test.w -t tf-aws 1651ms 1631ms 1699ms 14ms 20ms
empty.test.w -t sim 489ms 477ms 498ms 5ms 6ms
empty.test.w -t tf-aws 702ms 698ms 708ms 3ms 4ms
functions_10.test.w -t sim 594ms 583ms 606ms 6ms 8ms
functions_10.test.w -t tf-aws 2311ms 2291ms 2329ms 9ms 13ms
Last Updated (UTC) 2024-03-06 20:45

Copy link
Contributor

@MarkMcCulloh MarkMcCulloh left a comment

Choose a reason for hiding this comment

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

Very exciting! This PR supercedes #5547 right?

btw, on the note of worker vs child process: One of the big optimization options with workers is that you can share memory between them and the host, so we can use SharedArrayBuffer as a way to do fast (and still serialized) communication.

Might be an interesting future optimization, but cp makes sense now too

@Chriscbr
Copy link
Contributor Author

@MarkMcCulloh yep, I think this can supersede the other PR assuming the approach makes sense to y'all.

btw, on the note of worker vs child process: One of the big optimization options with workers is that you can share memory between them and the host, so we can use SharedArrayBuffer as a way to do fast (and still serialized) communication.

Interesting, yeah I see how that could give us some efficiency gains. It would be interesting to do some profiling on wing programs to see how much time is spent computing vs on IPC/HTTP etc.

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

Looking forward for this one!

examples/tests/valid/inflight_handler_singleton.test.w Outdated Show resolved Hide resolved
monadabot and others added 2 commits March 6, 2024 01:18
Signed-off-by: monada-bot[bot] <monabot@monada.co>
@Chriscbr Chriscbr marked this pull request as ready for review March 6, 2024 16:56
@Chriscbr Chriscbr requested a review from a team as a code owner March 6, 2024 16:56
Copy link
Contributor

mergify bot commented Mar 6, 2024

Thanks for contributing, @Chriscbr! This PR will now be added to the merge queue, or immediately merged if rybickic/separate-node-process is up-to-date with main and the queue is empty.

@mergify mergify bot merged commit 845360a into main Mar 6, 2024
27 checks passed
@mergify mergify bot deleted the rybickic/separate-node-process branch March 6, 2024 21:50
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.59.43.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment