Giter Club home page Giter Club logo

Comments (8)

ppedziwiatr avatar ppedziwiatr commented on August 19, 2024 1

fixed in #108, released in 0.4.36

from warp.

ppedziwiatr avatar ppedziwiatr commented on August 19, 2024

switch to https://developer.mozilla.org/en-US/docs/Web/API/structuredClone when it will be implemented by most of the browsers.

from warp.

balthazar avatar balthazar commented on August 19, 2024

👍🏻 Subscribing

from warp.

ppedziwiatr avatar ppedziwiatr commented on August 19, 2024

Performance comparison ("state evaluation" column) for "loot" contract:

  1. @ungap/structured-clone

image

  1. v8.deserialize(v8.serialize(input))

image

  1. lodash/cloneDeep

image

  1. JSON.parse(JSON.stringify(input, mapReplacer), mapReviver);

image

from warp.

balthazar avatar balthazar commented on August 19, 2024

Maybe I'm not reading the bench correctly, but isn't lodash more performant than ungap here?

from warp.

ppedziwiatr avatar ppedziwiatr commented on August 19, 2024

Maybe I'm not reading the bench correctly, but isn't lodash more performant than ungap here?

You're reading the bench correctly ;-) lodash indeed is more performant than ungap and v8 in this case. Though I believe that for "bigger" states - v8 was the winner. Anyway, I'll stick with lodash for now...

from warp.

ppedziwiatr avatar ppedziwiatr commented on August 19, 2024

Just a word of comment if anyone was interested - deepCopy-ing of the state is required for each interaction - before the state is passed to the contract's handler function. Contracts usually modify the state directly and without deepCopy - there would be risk of changing values somewhere in the host code (eg. values stored in cache).

v1 performed here simple stringify/parse https://github.com/ArweaveTeam/SmartWeave/blame/master/src/contract-step.ts#L56 - which obv. is least performant.

This won't be an issue in case of WASM contract - which store their state in the wasm module memory.

from warp.

balthazar avatar balthazar commented on August 19, 2024

Ah ok, I was confused with the commits being referenced using ungap, but they were probably old

🎉 Will try this

from warp.

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.