Currently, chopPrecisionAndTruncate/chopPrecisionAndTruncateNonMutative are doing the same thing, except that the former do it mutatively. Looking at the usages of chopPrecisionAndTruncate, the callers must alloc a new big.Int before calling it anyway, so any mutation will be done with this new allocated big.Int, instead of input argument. So, by making chopPrecisionAndTruncate always non-mutative, we simplify the code, and make the code faster, less allocation in some benchmarks. Benchmark for github.com/cosmos/cosmos-sdk/types: name old time/op new time/op delta CoinsAdditionIntersect/sizes:_A_1,_B_1-8 35.4ns ± 0% 35.1ns ± 0% -0.92% (p=0.008 n=5+5) CoinsAdditionIntersect/sizes:_A_5,_B_5-8 366ns ± 1% 363ns ± 1% ~ (p=0.056 n=5+5) CoinsAdditionIntersect/sizes:_A_5,_B_20-8 557ns ± 0% 553ns ± 0% -0.64% (p=0.008 n=5+5) CoinsAdditionIntersect/sizes:_A_1,_B_1000-8 6.17µs ± 0% 6.18µs ± 0% ~ (p=0.151 n=5+5) CoinsAdditionIntersect/sizes:_A_2,_B_1000-8 6.30µs ± 0% 6.32µs ± 0% +0.23% (p=0.008 n=5+5) CoinsAdditionNoIntersect/sizes:_A_1,_B_1-8 30.2ns ± 0% 29.9ns ± 1% -0.98% (p=0.008 n=5+5) CoinsAdditionNoIntersect/sizes:_A_5,_B_5-8 226ns ± 0% 224ns ± 0% -0.54% (p=0.008 n=5+5) CoinsAdditionNoIntersect/sizes:_A_5,_B_20-8 373ns ± 0% 372ns ± 0% -0.26% (p=0.040 n=5+5) CoinsAdditionNoIntersect/sizes:_A_1,_B_1000-8 6.21µs ± 0% 6.22µs ± 0% ~ (p=0.421 n=5+5) CoinsAdditionNoIntersect/sizes:_A_2,_B_1000-8 6.22µs ± 0% 6.23µs ± 0% ~ (p=0.286 n=5+5) CoinsAdditionNoIntersect/sizes:_A_1000,_B_2-8 6.22µs ± 0% 6.23µs ± 0% ~ (p=0.143 n=5+5) ParseCoin-8 5.46µs ± 0% 5.39µs ± 0% -1.26% (p=0.008 n=5+5) UintMarshal-8 1.01µs ± 0% 1.00µs ± 0% -1.10% (p=0.008 n=5+5) IntMarshal-8 764ns ± 0% 758ns ± 1% -0.79% (p=0.024 n=5+5) MarshalTo-8 192ns ± 0% 190ns ± 0% -1.03% (p=0.008 n=5+5) name old alloc/op new alloc/op delta CoinsAdditionIntersect/sizes:_A_1,_B_1-8 32.0B ± 0% 32.0B ± 0% ~ (all equal) CoinsAdditionIntersect/sizes:_A_5,_B_5-8 520B ± 0% 520B ± 0% ~ (all equal) CoinsAdditionIntersect/sizes:_A_5,_B_20-8 1.38kB ± 0% 1.38kB ± 0% ~ (all equal) CoinsAdditionIntersect/sizes:_A_1,_B_1000-8 49.2kB ± 0% 49.2kB ± 0% ~ (all equal) CoinsAdditionIntersect/sizes:_A_2,_B_1000-8 49.3kB ± 0% 49.3kB ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_1,_B_1-8 24.0B ± 0% 24.0B ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_5,_B_5-8 488B ± 0% 488B ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_5,_B_20-8 1.35kB ± 0% 1.35kB ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_1,_B_1000-8 49.2kB ± 0% 49.2kB ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_2,_B_1000-8 49.2kB ± 0% 49.2kB ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_1000,_B_2-8 49.2kB ± 0% 49.2kB ± 0% ~ (all equal) ParseCoin-8 2.21kB ± 0% 2.21kB ± 0% ~ (all equal) UintMarshal-8 392B ± 0% 392B ± 0% ~ (all equal) IntMarshal-8 168B ± 0% 168B ± 0% ~ (all equal) MarshalTo-8 80.0B ± 0% 80.0B ± 0% ~ (all equal) name old allocs/op new allocs/op delta CoinsAdditionIntersect/sizes:_A_1,_B_1-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) CoinsAdditionIntersect/sizes:_A_5,_B_5-8 12.0 ± 0% 12.0 ± 0% ~ (all equal) CoinsAdditionIntersect/sizes:_A_5,_B_20-8 14.0 ± 0% 14.0 ± 0% ~ (all equal) CoinsAdditionIntersect/sizes:_A_1,_B_1000-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) CoinsAdditionIntersect/sizes:_A_2,_B_1000-8 6.00 ± 0% 6.00 ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_1,_B_1-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_5,_B_5-8 5.00 ± 0% 5.00 ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_5,_B_20-8 6.00 ± 0% 6.00 ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_1,_B_1000-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_2,_B_1000-8 4.00 ± 0% 4.00 ± 0% ~ (all equal) CoinsAdditionNoIntersect/sizes:_A_1000,_B_2-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) ParseCoin-8 71.0 ± 0% 71.0 ± 0% ~ (all equal) UintMarshal-8 25.0 ± 0% 25.0 ± 0% ~ (all equal) IntMarshal-8 18.0 ± 0% 18.0 ± 0% ~ (all equal) MarshalTo-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) name old speed new speed delta UintMarshal-8 6.91MB/s ± 0% 6.99MB/s ± 0% +1.04% (p=0.008 n=5+5) IntMarshal-8 9.16MB/s ± 0% 9.23MB/s ± 1% +0.83% (p=0.032 n=5+5) Benchmark for github.com/cosmos/cosmos-sdk/x/mint/types: name old time/op new time/op delta BlockProvision-8 263ns ± 0% 257ns ± 0% -2.23% (p=0.008 n=5+5) name old alloc/op new alloc/op delta BlockProvision-8 112B ± 0% 104B ± 0% -7.14% (p=0.008 n=5+5) name old allocs/op new allocs/op delta BlockProvision-8 6.00 ± 0% 5.00 ± 0% -16.67% (p=0.008 n=5+5) Fixes #9249 Co-authored-by: Emmanuel T Odeke <emmanuel@orijtech.com> |
||
|---|---|---|
| .github | ||
| baseapp | ||
| client | ||
| codec | ||
| contrib | ||
| cosmovisor | ||
| crypto | ||
| docs | ||
| internal/conv | ||
| proto/cosmos | ||
| scripts | ||
| server | ||
| simapp | ||
| snapshots | ||
| std | ||
| store | ||
| telemetry | ||
| tests | ||
| testutil | ||
| third_party/proto | ||
| types | ||
| version | ||
| x | ||
| .build.sh | ||
| .clang-format | ||
| .codecov.yml | ||
| .deepsource.toml | ||
| .dockerignore | ||
| .gitattributes | ||
| .gitignore | ||
| .golangci.yml | ||
| .goreleaser.yml | ||
| .mergify.yml | ||
| buf.yaml | ||
| CHANGELOG.md | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| SECURITY.md | ||
| STABLE_RELEASES.md | ||
Cosmos SDK
The Cosmos-SDK is a framework for building blockchain applications in Golang.
It is being used to build Gaia, the first implementation of the Cosmos Hub.
WARNING: The SDK has mostly stabilized, but we are still making some breaking changes.
Note: Requires Go 1.15+
Quick Start
To learn how the SDK works from a high-level perspective, go to the SDK Intro.
If you want to get started quickly and learn how to build on top of the SDK, please follow the SDK Application Tutorial. You can also fork the tutorial's repository to get started building your own Cosmos SDK application.
For more, please go to the Cosmos SDK Docs.
Cosmos Hub Mainnet
The Cosmos Hub application, gaia, has moved to its own repository. Go there to join the Cosmos Hub mainnet and more.
Interblockchain Communication (IBC)
The IBC module for the SDK has moved to its own repository. Go there to build and integrate with the IBC module.
Starport
If you are starting a new app or a new module you can use Starport to help you get started and speed up development. If you have any questions or find a bug, feel free to open an issue in the repo.
Disambiguation
This Cosmos-SDK project is not related to the React-Cosmos project (yet). Many thanks to Evan Coury and Ovidiu (@skidding) for this Github organization name. As per our agreement, this disambiguation notice will stay here.
