Struct noble_contracts::InstructionWeights[][src]

pub struct InstructionWeights<T: Config> {
    pub i64const: u32,
    pub i64load: u32,
    pub i64store: u32,
    pub select: u32,
    pub if: u32,
    pub br: u32,
    pub br_if: u32,
    pub br_table: u32,
    pub br_table_per_entry: u32,
    pub call: u32,
    pub call_indirect: u32,
    pub call_indirect_per_param: u32,
    pub local_get: u32,
    pub local_set: u32,
    pub local_tee: u32,
    pub global_get: u32,
    pub global_set: u32,
    pub memory_current: u32,
    pub memory_grow: u32,
    pub i64clz: u32,
    pub i64ctz: u32,
    pub i64popcnt: u32,
    pub i64eqz: u32,
    pub i64extendsi32: u32,
    pub i64extendui32: u32,
    pub i32wrapi64: u32,
    pub i64eq: u32,
    pub i64ne: u32,
    pub i64lts: u32,
    pub i64ltu: u32,
    pub i64gts: u32,
    pub i64gtu: u32,
    pub i64les: u32,
    pub i64leu: u32,
    pub i64ges: u32,
    pub i64geu: u32,
    pub i64add: u32,
    pub i64sub: u32,
    pub i64mul: u32,
    pub i64divs: u32,
    pub i64divu: u32,
    pub i64rems: u32,
    pub i64remu: u32,
    pub i64and: u32,
    pub i64or: u32,
    pub i64xor: u32,
    pub i64shl: u32,
    pub i64shrs: u32,
    pub i64shru: u32,
    pub i64rotl: u32,
    pub i64rotr: u32,
    pub _phantom: PhantomData<T>,
}

Describes the weight for all categories of supported wasm instructions.

There there is one field for each wasm instruction that describes the weight to execute one instruction of that name. There are a few execptions:

  1. If there is a i64 and a i32 variant of an instruction we use the weight of the former for both.
  2. The following instructions are free of charge because they merely structure the wasm module and cannot be spammed without making the module invalid (and rejected): End, Unreachable, Return, Else
  3. The following instructions cannot be benchmarked because they are removed by any real world execution engine as a preprocessing step and therefore don’t yield a meaningful benchmark result. However, in contrast to the instructions mentioned in 2. they can be spammed. We price them with the same weight as the “default” instruction (i64.const): Block, Loop, Nop
  4. We price both i64.const and drop as InstructionWeights.i64const / 2. The reason for that is that we cannot benchmark either of them on its own but we need their individual values to derive (by subtraction) the weight of all other instructions that use them as supporting instructions. Supporting means mainly pushing arguments and dropping return values in order to maintain a valid module.

Fields

i64const: u32i64load: u32i64store: u32select: u32if: u32br: u32br_if: u32br_table: u32br_table_per_entry: u32call: u32call_indirect: u32call_indirect_per_param: u32local_get: u32local_set: u32local_tee: u32global_get: u32global_set: u32memory_current: u32memory_grow: u32i64clz: u32i64ctz: u32i64popcnt: u32i64eqz: u32i64extendsi32: u32i64extendui32: u32i32wrapi64: u32i64eq: u32i64ne: u32i64lts: u32i64ltu: u32i64gts: u32i64gtu: u32i64les: u32i64leu: u32i64ges: u32i64geu: u32i64add: u32i64sub: u32i64mul: u32i64divs: u32i64divu: u32i64rems: u32i64remu: u32i64and: u32i64or: u32i64xor: u32i64shl: u32i64shrs: u32i64shru: u32i64rotl: u32i64rotr: u32_phantom: PhantomData<T>

The type parameter is used in the default implementation.

Trait Implementations

impl<T: Clone + Config> Clone for InstructionWeights<T>[src]

impl<T: Config> Debug for InstructionWeights<T>[src]

impl<T: Config> Decode for InstructionWeights<T> where
    PhantomData<T>: Decode,
    PhantomData<T>: Decode
[src]

impl<T: Config> Default for InstructionWeights<T>[src]

impl<'de, T: Config> Deserialize<'de> for InstructionWeights<T>[src]

impl<T: Config> Encode for InstructionWeights<T> where
    PhantomData<T>: Encode,
    PhantomData<T>: Encode
[src]

impl<T: Config> EncodeLike<InstructionWeights<T>> for InstructionWeights<T> where
    PhantomData<T>: Encode,
    PhantomData<T>: Encode
[src]

impl<T: Eq + Config> Eq for InstructionWeights<T>[src]

impl<T: PartialEq + Config> PartialEq<InstructionWeights<T>> for InstructionWeights<T>[src]

impl<T: Config> Serialize for InstructionWeights<T>[src]

impl<T: Config> StructuralEq for InstructionWeights<T>[src]

impl<T: Config> StructuralPartialEq for InstructionWeights<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for InstructionWeights<T> where
    T: RefUnwindSafe

impl<T> Send for InstructionWeights<T> where
    T: Send

impl<T> Sync for InstructionWeights<T> where
    T: Sync

impl<T> Unpin for InstructionWeights<T> where
    T: Unpin

impl<T> UnwindSafe for InstructionWeights<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> Clear for T where
    T: Default + Eq + PartialEq<T>, 
[src]

impl<S> Codec for S where
    S: Decode + Encode
[src]

impl<T> DecodeAll for T where
    T: Decode
[src]

impl<T> DecodeLimit for T where
    T: Decode
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<T> DynClone for T where
    T: Clone
[src]

impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ mut T> for T where
    T: Encode
[src]

impl<T> EncodeLike<Arc<T>> for T where
    T: Encode
[src]

impl<T> EncodeLike<Box<T, Global>> for T where
    T: Encode
[src]

impl<'a, T> EncodeLike<Cow<'a, T>> for T where
    T: ToOwned + Encode
[src]

impl<T> EncodeLike<Rc<T>> for T where
    T: Encode
[src]

impl<T> From<T> for T[src]

impl<S> FullCodec for S where
    S: Decode + FullEncode
[src]

impl<S> FullEncode for S where
    S: Encode + EncodeLike<S>, 
[src]

impl<T> Hashable for T where
    T: Codec
[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 
[src]

pub fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> KeyedVec for T where
    T: Codec
[src]

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

impl<T> MaybeSerialize for T where
    T: Serialize
[src]

impl<T> MaybeSerializeDeserialize for T where
    T: DeserializeOwned + Serialize
[src]

impl<T> Member for T where
    T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone
[src]

impl<T> Parameter for T where
    T: Codec + EncodeLike<T> + Clone + Eq + Debug
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,