ref-fvm icon indicating copy to clipboard operation
ref-fvm copied to clipboard

Optimize actor performance

Open Stebalien opened this issue 3 years ago • 6 comments

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 avatar Jan 14 '22 06:01 Stebalien

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

  • Make sure the FVM itself is compiled in release mode.
  • Make sure the wasm modules are pre-compiled (from WASM bytecode to native machine code) and cached. You may want to add a manual step in your tests to "warm" wasmtime's module cache.

Stebalien avatar Jan 14 '22 06:01 Stebalien

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)

laudiacay avatar Jan 14 '22 18:01 laudiacay

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.

Stebalien avatar Jan 14 '22 19:01 Stebalien

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: @.***>

laudiacay avatar Jan 15 '22 00:01 laudiacay

@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?

raulk avatar Mar 09 '22 16:03 raulk

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.

Stebalien avatar Mar 09 '22 17:03 Stebalien

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

raulk avatar Sep 03 '22 11:09 raulk

There really isn't much use in tracking this.

Stebalien avatar Sep 07 '22 15:09 Stebalien