Code Monkey home page Code Monkey logo

Comments (4)

sorpaas avatar sorpaas commented on August 22, 2024

Moved to https://github.com/ethereumproject/sputnikvm/wiki/Performance-Improvements due to #175.

from sputnikvm.

sorpaas avatar sorpaas commented on August 22, 2024

lazy_static deps is now used in the core sputnikvm crate.

from sputnikvm.

zjhmale avatar zjhmale commented on August 22, 2024

@sorpaas So all these precompiled gas functions need to be utilized with lazy_static right?

image

from sputnikvm.

sorpaas avatar sorpaas commented on August 22, 2024

Actually originally this was related to all const variables here (https://github.com/ethereumproject/sputnikvm/blob/master/src/eval/cost.rs#L9). Because Gas needs to be constructed on the fly and it's not free, it might be a performance issue. (See all the Into::into() below.)

Still, however, I just realized that Gas implements Copy trait, so even if when it is lazy-static-ed it might still not help a lot. A constraint on the Ethereum blockchain is that Gas, although its theoretical max value is U256::max_value(), it in practice cannot exceed usize::max_value(). A better way to handle this is probably to make Gas a type parameter in all VM structs. After that, track the initial provided gas, if that value exceeds usize::max_value(), use usize as the type parameter, otherwise, fallback to the full U256 (the conditional check does not need to be in the sputnikvm library).

The type parameter of gas G usually only needs Add + Mul + Sub + From<usize>. In the calculation of memory cost, however, there needs to be a checked multiply which does not belong to a trait, so a custom trait might need to be created for that.

Oops sorry I probably should be more careful when labeling an issue as "good first issue".

from sputnikvm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.