Skip to content
New issue

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

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

Already on GitHub? # to your account

Benchmark Testing POC #10975

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

muhammadahmadasifbhatti
Copy link

@muhammadahmadasifbhatti muhammadahmadasifbhatti commented Feb 10, 2025

Description

This is PR is just a minimalistic POC to create a small tool for the benchmark testing.

How to run locally

Run the command yarn test in the packages/benchmark-test folder.

Pre-reqs of running yarn test

Install esvu globally

Select the v8 and xs from CLI so that it can download the binaries of those engines.

Install eshost-cli globally.

Run the following commands to configure the binaries of engines with eshost.

  • eshost --add "v8" d8 $ESHOST_PATH_V8
  • eshost --add "xs" xs $ESHOST_PATH_XS

Now you are good to go to run yarn test

Muhammad Ahmad added 2 commits February 10, 2025 15:44
Copy link

cloudflare-workers-and-pages bot commented Feb 10, 2025

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: e32d54c
Status:🚫  Build failed.

View logs

erights added a commit that referenced this pull request Feb 11, 2025
erights added a commit to endojs/endo that referenced this pull request Feb 13, 2025
Closes: #XXXX
Refs: Agoric/agoric-sdk#10975
Agoric/agoric-sdk#10982

## Description

Using the benchmark tool from #10975 by @muhammadahmadasifbhatti as
modified by #10982 to produce flamegraphs (interactive in vscode) I
iterated on that benchmark test which already had very specific simple
examples exercising `passStyleOf`. Together with the snippet at
https://github.com/Agoric/agoric-sdk/blob/acbb5da3c5a52bab8db319fd696aed70146f9a89/.github/actions/restore-node/action.yml#L156
(which @gibson042 brought to my attention)

```sh
$ scripts/get-packed-versions.sh ~/endo | scripts/resolve-versions.sh
$ yarn install && yarn build
$ cd packages/benchmark-test
$ yarn bench
```
and then clicking on the latest *.cpuprofile file, assuming you've
already installed the
https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-js-profile-flame
vscode extension.

I was able to iterate and tinker on possible improvements, to see what
made how much of a difference. This PR has the improvements to
`passStyleOf` that I and my reviewers have came up with so far.

@gibson042 suggested the main technique used: to avoid redundant
checking by breaking up `assertValid` so we could still running the
checks of `canBeValid` twice.

### Security Considerations

I claim that this PR is a pure refactoring. If true, none.
***Reviewers***, please review with a skeptical eye. `passStyleOf` is
security critical, so any observable difference might lead to an
opportunity for an adversary.

### Scaling Considerations

Even though I iterated on a specialized benchmark exercising
`passStyleOf`, I believe I only made changes that would also be an
improvement for the typical cases.

### Documentation Considerations

If this is a pure refactor, none.

### Testing Considerations

If this is a pure refactor, none. In fact, this PR did not need to
change any tests, providing some weak evidence that it is indeed a pure
refactor.

### Compatibility Considerations

If this is a pure refactor, none.

### Upgrade Considerations

If this is a pure refactor, none.
muhammadahmadasifbhatti added a commit to endojs/endo that referenced this pull request Feb 28, 2025
Note: This PR is migrated from the
[`agoric-sdk`](Agoric/agoric-sdk#10975). All the
comments from [Mark's reviewed
PR](Agoric/agoric-sdk#10982) are addressed.

### Description
This is PR is just a minimalistic POC to create a small tool for the
benchmark testing.

### How to run locally
Run the command `yarn test` in the `packages/benchmark-test` folder.

### Pre-reqs of running `yarn test`
Run the command `yarn install-engines` to ensure installation of V8 and
XS engines in `$HOME/.esvu` for this package's `eshost`.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant