generate-weights.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/usr/bin/env bash
  2. # Executes and replaces all benchmarks with the new weights
  3. SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
  4. STEPS=${1:-50}
  5. REPEAT=${2:-20}
  6. benchmark() {
  7. echo "Generating weights for $1..."
  8. start=`date +%s`
  9. ERROR=$($SCRIPT_DIR/../target/release/joystream-node benchmark \
  10. --pallet=$1 \
  11. --extrinsic=* \
  12. --chain=dev \
  13. --steps=$STEPS \
  14. --repeat=$REPEAT \
  15. --execution=wasm \
  16. --output=. 2>&1 > /dev/null)
  17. if [[ $ERROR != *"Error"* ]]; then
  18. end=`date +%s`
  19. mv $SCRIPT_DIR/../*.rs $SCRIPT_DIR/../runtime/src/weights/
  20. echo "Weights generated successfully for $1"
  21. echo "It took $((end-start)) seconds"
  22. else
  23. >&2 echo "$ERROR"
  24. >&2 echo "There was a problem generating the weights for $1, check the error above"
  25. exit 1
  26. fi
  27. }
  28. # FRAME benchmarks
  29. # Some FRAME pallets are commented out since the parameter's in some of the extrinsic's
  30. # benchmarking are being discarded and we can't adjust the trait since it's part of
  31. # Substrate. This problem has been fixed in this PR: https://github.com/paritytech/substrate/pull/7233
  32. # So uncomment this when we move to a version that contains that PR.
  33. # See issue: #1979
  34. benchmark frame_system
  35. benchmark substrate_utility
  36. benchmark pallet_session
  37. benchmark pallet_timestamp
  38. # Pallet staking benchmarking takes too long.
  39. # benchmark pallet_staking
  40. # Benchmark should be run on the reference machine because it affects the fee model (transfer fee).
  41. # benchmark pallet_balances
  42. # This benchmark takes too long with 50 steps and 20 repeats in a normal laptop.
  43. # Will have it commented out until we test it in the reference machine. If there
  44. # it still takes too long we will get rid of this benchmark for good and use always
  45. # the default weights.
  46. # benchmark pallet_im_online
  47. # Joystrem benchmarks
  48. benchmark proposals_discussion
  49. benchmark proposals_engine
  50. benchmark proposals_codex
  51. benchmark pallet_constitution
  52. benchmark working_group
  53. benchmark council
  54. benchmark referendum
  55. benchmark forum
  56. benchmark membership
  57. benchmark bounty
  58. benchmark blog
  59. benchmark joystream_utility
  60. #benchmark storage