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

Add EVM transactions to FVM benchmark tests #5061

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

janezpodhostnik
Copy link
Contributor

I added a benchmark (and a control) that calls EVM.run 100 times. Which allows us to benchmark EVM calls in relation to other calls.

The "control" is exactly the same FVM code except the call to EVM.run is skipped.

The results are:

Name Time taken Computation used
BenchmarkRuntimeTransaction/evm-12 212200909 ns/op 651.0 computation
BenchmarkRuntimeTransaction/evm_control-12 43778713 ns/op 251.0 computation
BenchmarkRuntimeTransaction/reference_tx-12 17323187 ns/op 202.0 computation
BenchmarkRuntimeTransaction/transfer_tokens-12 82748625 ns/op 3502 computation

To get a comparison we can do the following operation:

(evm - evm_cotrol) / (transfer_tokens - reference_tx)

Which gets us that the EVM.run call is 2.57 times slower than a token transfer but costs 0.12 times the computation.

import FungibleToken from 0x%s
import FlowToken from 0x%s
import TestContract from 0x%s
import EVM from 0x%s
Copy link
Contributor

Choose a reason for hiding this comment

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

would this import affect non-evm tests? would it make sense to only have this for fvm benchmarks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does, but the important part of these tests is the comparative performance.

We can deduct the cost of that import by looking at the reference_tx which is basically a (almost) no-op transaction

Copy link
Contributor

Choose a reason for hiding this comment

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

ohh nice, then it doesn't matter yeah

fvm/fvm_bench_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sideninja sideninja left a comment

Choose a reason for hiding this comment

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

Left some comments but looks good. Nice findings

@janezpodhostnik janezpodhostnik changed the title Add EVM transactions To FVM benchmark tests Add EVM transactions to FVM benchmark tests Nov 27, 2023
@codecov-commenter
Copy link

codecov-commenter commented Nov 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8dd3ba0) 54.67% compared to head (862a02b) 56.21%.
Report is 59 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5061      +/-   ##
==========================================
+ Coverage   54.67%   56.21%   +1.53%     
==========================================
  Files         675      977     +302     
  Lines       65888    91105   +25217     
==========================================
+ Hits        36026    51214   +15188     
- Misses      27128    36084    +8956     
- Partials     2734     3807    +1073     
Flag Coverage Δ
unittests 56.21% <ø> (+1.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@janezpodhostnik janezpodhostnik added this pull request to the merge queue Nov 29, 2023
Merged via the queue into master with commit cb368bc Nov 29, 2023
54 checks passed
@janezpodhostnik janezpodhostnik deleted the janez/add-evm-tx-to-bench branch November 29, 2023 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants