8000 FIO-9783: evaluate code on demand by brendanbond · Pull Request #1968 · formio/formio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

FIO-9783: evaluate code on demand #1968

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

8000
Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Conversation

brendanbond
Copy link
Contributor
@brendanbond brendanbond commented Apr 24, 2025

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-9783

Description

We've identified a bottleneck in the way we perform form validation in our Enterprise Server - creating VM contexts per request and executing the entire form orchestration pipeline in those contexts turns out to be kind of slow and expensive. To mitigate this, I've made changes to the core and vm library to enable extending the Evaluator and injecting a vm directly into the evaluator, very similar to how we used to leverage VM2.

This PR introduces the IsolateVMEvaluator, an extension of @formio/core's Evaluator class that uses the new IsolateVM from @formio/vm to sandbox and execute JavaScript on demand rather than compiling the entire process into the VM per request. My informal benchmarks show a speedup on certain types of requests of around 5x. It also moves logic that was previously in the vm library to where it belongs - where it is executed (e.g. email rendering).

Breaking Changes / Backwards Compatibility

Although this introduces a lot of risk, there are no intentional breaking changes here.

Dependencies

@formio/core#245
@formio/vm#58

How has this PR been tested?

Tests (including new email rendering tests) are all passing. I've additionally that were originally in the @formio/vm library into this repository as appropriate.

Checklist:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

@brendanbond brendanbond marked this pull request as ready for review May 2, 2025 21:47
@brendanbond brendanbond changed the title FIO- 8000 9783: ivm alt FIO-9783: evaluate code on demand May 4, 2025
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.

1 participant
0