filecoin-project / ref-fvm

Reference implementation of the Filecoin Virtual Machine
https://fvm.filecoin.io/
Other
384 stars 139 forks source link

Optimize actor performance #265

Closed Stebalien closed 2 years ago

Stebalien commented 2 years ago

Performance is going to be pretty critical. We need to investigate things like:

  1. [ ] Trade-offs between "z", "s" and "3" optimization levels (for actors).
  2. [ ] Passing different optimization options to wasmtime.
  3. [ ] Enabling simd in wasmtime.
  4. [ ] Performing SHA256 hashing (used inside HAMTs) via a syscall instead of inside WASM.
  5. [ ] Actor optimizations (e.g., some cases could benefit from using btrees instead of hashmaps/sorting).
  6. [ ] Syscall overhead (does our syscall glue optimize out well?).
Stebalien commented 2 years ago

Method: Benchmark the conformance (testing/conformance) tests. Pitfalls:

laudiacay commented 2 years ago

VECTOR=test-vectors/corpus/specs_actors_v6/TestCronCatchedCCExpirationsAtDeadlineBoundary/c70afe9fa5e05990cac8ab8d4e49522919ad29e5be3f81ee4b59752c36c4a701-t0100-t0102-storageminer-6.json cargo test -- --nocapture --color=always (just keeping this here because useful)

Stebalien commented 2 years ago

It won't help with analyzing the internal wasm code, but https://github.com/flamegraph-rs/flamegraph may help in finding hotspots in the syscalls.

laudiacay commented 2 years ago

Hehe I’ve already started trying to wire this up- was hoping it might help with the wasm, was destined to figure that out the hard way… I’ll hunt down another wasm profiler, someone has to have built one.

On Fri, Jan 14, 2022 at 1:18 PM Steven Allen @.***> wrote:

It won't help with analyzing the internal wasm code, but https://github.com/flamegraph-rs/flamegraph may help in finding hotspots in the syscalls.

— Reply to this email directly, view it on GitHub https://github.com/filecoin-project/fvm/issues/265#issuecomment-1013390324, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDPMJCSPOTXRZ5FTFCQKWTUWBZHBANCNFSM5L54UMOQ . You are receiving this because you were assigned.Message ID: @.***>

raulk commented 2 years ago

@Stebalien I suspect you already analyzed these AIs:

Trade-offs between "z", "s" and "3" optimization levels (for actors). Passing different optimization options to wasmtime.

Mind posting your discoveries?

Stebalien commented 2 years ago

Trade-offs between "z", "s" and "3" optimization levels (for actors).

I haven't. Well, I tried, but it turns out that the wasm builder was ignoring our flags when I last tried.

raulk commented 2 years ago

@Stebalien which of these investigations are still pending? I think we should track the open ones as issues in builtin-actors.

Stebalien commented 2 years ago

There really isn't much use in tracking this.