generate-weights.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env bash
  2. # Executes and replaces all benchmarks with the new weights
  3. SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
  4. benchmark() {
  5. echo "Generating weights for $1..."
  6. start=`date +%s`
  7. $SCRIPT_DIR/../target/release/joystream-node benchmark \
  8. --pallet=$1 \
  9. --extrinsic=* \
  10. --chain=dev \
  11. --steps=50 \
  12. --repeat=20 \
  13. --execution=wasm \
  14. --output=. > /dev/null
  15. end=`date +%s`
  16. if [ $? -eq 0 ]; then
  17. mv $SCRIPT_DIR/../*.rs $SCRIPT_DIR/../runtime/src/weights/
  18. echo "Weights generated successfully for $1"
  19. echo "It took $((end-start)) seconds"
  20. else
  21. echo "There was a problem generating the weights for $1, check the error above"
  22. fi
  23. }
  24. # FRAME benchmarks
  25. benchmark frame_system
  26. benchmark pallet_utility
  27. benchmark pallet_session
  28. benchmark pallet_timestamp
  29. # This benchmark takes too long with 50 steps and 20 repeats in a normal laptop.
  30. # Will have it commented out until we test it in the reference machine. If there
  31. # it still takes too long we will get rid of this benchmark for good and use always
  32. # the default weights.
  33. # benchmark pallet_im_online
  34. # Joystrem benchmarks
  35. benchmark proposals_discussion
  36. benchmark proposals_engine
  37. benchmark pallet_constitution
  38. benchmark working_group