Comments (3)
I'm inclined to implement this not by changing the iterator in isolation, but changing the Vec
so that a Vec
is a handle plus a start and an end, so that repeatedly slicing a Vec
makes no interactions with the host.
from rs-soroban-sdk.
I was just reviewing the documentation for im_rc
in a different context. It occurred to me that we should be very careful to make sure the SDK interface we provide uses im_rc
efficiently. For example, I am accustomed to Vec::get
being O(1)
but this is not true for im_rc::Vector::get
which is O(log n)
. In fact, every data access operation is O(log n)
. Furthermore, the documentation for im_rc::vector::Iter
and im_rc::vector::Focus
emphasize that using a Focus
can produce an order of magnitude speed-up in certain repeated look-up situations.
Given the above, should we expose im_rc::vector::Iter
as a first-class host object? What about for im_rc::vector::Focus
? It feels weird to me to expose this level of implementation detail, but at the same time I feel like we should provide tools for people to use system resources efficiently.
from rs-soroban-sdk.
I think leaking idiosyncrasies of the im_rc::Vector
come at a cost that has to be measured. i.e. What contracts will this impact, and by how much.
Digging into it though, would the changes you're suggesting – exposing Iter and Focus – be things the SDK consumes, or that users consume? If these are things the SDK consumes it's not so bad, but once we start pushing im_rc
qualities to users we've bound the way their code works to it which would probably make it difficult for us to make changes to vector in the future. Or worse, we are bound to im_rc's implementation that could change.
from rs-soroban-sdk.
Related Issues (20)
- Setting a field name with length greater than limit generates invalid contract spec HOT 1
- Test Bug: Temporary Storage HOT 1
- Why does this contract have unexpected temporary entries in test snapshot?
- Cannot use `env.prng` at the root of a test HOT 2
- Improve errors for type conversion failure especially at contract function boundary
- document guarantees (and lackthereof) of ledger `timestamp()`
- Contract deploying and invoking result in `xdr processing error: xdr value invalid` whenever anything is changed slightly from examples HOT 4
- String append / concat HOT 9
- Remove `--base-version` from cargo semver-checks action
- Client is not the zero-cost abstraction it hoped to be HOT 1
- Evaluate if Symbol::new should try to optimize or always create symbol using host fn
- Make Env::from_snapshot_file return meaningful error when someone calls it with a ledger snapshot
- Feature to easily opt out of test_snapshots generation HOT 1
- Ledger snapshots store both the key and values unnecessarily
- Why does `Map::try_get` not take a reference to the generic key? HOT 2
- Add support for invariant testing
- Add support for inline generated snapshots
- Add automated resource cost reports
- Splitting contract impls across modules leads to errors HOT 1
- Explore ways to support contract extensibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rs-soroban-sdk.