Go to file
Emmanuel T Odeke 00ad3ecedc
perf: crypto/types: use native slice index producing for loop in (*CompactBitArry).NumTrueBitsBefore (#14000)
Noticed while examining a bunch of profiles, that the for loop inside
(*CompactBitArry).NumTrueBitsBefore unnecessarily consumed a bunch of
time:
```shell
     7.55s      9.88s (flat, cum) 93.38% of Total
     240ms      250ms     88:func (bA *CompactBitArray) NumTrueBitsBefore(index int) int {
         .          .     89:	onesCount := 0
      70ms      340ms     90:	max := bA.Count()
      70ms       70ms     91:	if index > max {
         .          .     92:		index = max
         .          .     93:	}
         .          .     94:	// below we iterate over the bytes then over bits (in low endian) and count bits set to 1
     2.54s      2.76s     95:	for elem := 0; elem < len(bA.Elems); elem++ {
```

but we can use the native for loop that produces indices while iterating
over slices. Just by simply changing the form results in an improvement

```shell
     7.50s      9.95s (flat, cum) 94.94% of Total
     240ms      320ms     88:func (bA *CompactBitArray) NumTrueBitsBefore(index int) int {
         .          .     89:	onesCount := 0
     170ms      420ms     90:	max := bA.Count()
      90ms      100ms     91:	if index > max {
         .          .     92:		index = max
         .          .     93:	}
         .          .     94:	// below we iterate over the bytes then over bits (in low endian) and count bits set to 1
     1.49s      1.62s     95:	for elem := range bA.Elems {
```

and an improvement in CPU time

```shell
$ benchstat before.txt after.txt
name                     old time/op    new time/op    delta
NumTrueBitsBefore/new-8    13.3ns ± 1%    12.5ns ± 1%  -6.07%  (p=0.000 n=10+10)

name                     old alloc/op   new alloc/op   delta
NumTrueBitsBefore/new-8     0.00B          0.00B         ~     (all equal)

name                     old allocs/op  new allocs/op  delta
NumTrueBitsBefore/new-8      0.00           0.00         ~     (all equal)
```

Fixes #13999
2022-11-24 10:46:04 +00:00
.github ci: improve test skipping mechanism (#13987) 2022-11-23 14:39:43 +01:00
.vscode feat: add vscode e2e config (#13851) 2022-11-14 11:26:28 +01:00
api fix(group): migrate group policy account to base accounts with credentials (#13742) 2022-11-21 22:46:48 +00:00
baseapp feat: sender mempool impl (#13888) 2022-11-24 00:15:41 +01:00
client chore: add group and gov/v1 in swagger (#13984) 2022-11-24 00:24:38 +01:00
codec fix: add gRPC nil/zero check in query (#13352) 2022-09-29 01:20:03 +00:00
contrib ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
core ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
crypto perf: crypto/types: use native slice index producing for loop in (*CompactBitArry).NumTrueBitsBefore (#14000) 2022-11-24 10:46:04 +00:00
depinject ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
docs feat: value renderer for google.protobuf.Any (#13671) 2022-11-24 08:04:55 +00:00
errors ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
fuzz refactor: clean-up SDK tools (#13603) 2022-10-21 15:15:20 +00:00
internal refactor: add sdk.LogDeferred to report errors in defers (#13619) 2022-10-26 15:42:19 +00:00
math ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
orm build(deps): Bump google.golang.org/grpc from 1.50.1 to 1.51.0 (#13953) 2022-11-21 17:46:07 +01:00
proto fix(group): migrate group policy account to base accounts with credentials (#13742) 2022-11-21 22:46:48 +00:00
runtime refactor!: migrate to core appmodule.AppModule extension interfaces (#13794) 2022-11-14 21:23:55 +00:00
scripts ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
server fix(group): migrate group policy account to base accounts with credentials (#13742) 2022-11-21 22:46:48 +00:00
simapp ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
snapshots fix: double close (#13400) 2022-09-27 18:16:13 +00:00
std fix: register evidence regression (#10595) 2021-12-14 14:25:31 +00:00
store refactor: State Streaming Docs + Explicit Config Support (#13894) 2022-11-17 18:48:44 +00:00
telemetry fix: all: fix resource leaks found by staticmajor (#13394) 2022-10-06 20:11:40 +00:00
tests ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
testutil ci: configure sonarcloud (#13921) 2022-11-18 15:14:49 +00:00
third_party/proto chore: proto format (#13685) 2022-10-28 17:40:48 +02:00
tools ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
tx feat: value renderer for google.protobuf.Any (#13671) 2022-11-24 08:04:55 +00:00
types feat: sender mempool impl (#13888) 2022-11-24 00:15:41 +01:00
version chore: fix linting issues exposed by fixing golangci-lint (#12895) 2022-08-11 22:00:24 +02:00
x fix: make downgrade verification work again (#13936) 2022-11-23 10:51:54 +00:00
.clang-format chore: improve proto formatting (#12656) 2022-07-21 10:56:31 +00:00
.dockerignore Add basic Dockerfile to build all binaries and export gaiad 2018-04-10 12:39:47 +02:00
.gitattributes Merge PR #6426: Migrate API Server 2020-06-15 13:39:09 -04:00
.gitignore ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
.gitpod.yml Create .gitpod.yml (#12662) 2022-08-15 15:18:30 +02:00
.golangci.yml build(deps): Bump github.com/golangci/golangci-lint from 1.48.0 to 1.49.0 (#13013) 2022-08-24 23:13:11 +02:00
.goreleaser.yml ci: fix release notes not populated by goreleaser 2022-08-13 20:41:27 +02:00
.markdownlint.json docs: Code blocks in SDK docs are broken (#11189) 2022-02-14 23:39:35 +01:00
.markdownlintignore docs: Improve markdownlint configuration (#11104) 2022-02-10 12:07:01 +00:00
.mergify.yml chore: update .mergify.yml #13841 2022-11-11 18:49:36 +00:00
buf.work.yaml refactor: migrate to cosmos/gogoproto (#13070) 2022-09-08 17:27:48 +00:00
CHANGELOG.md fix: make downgrade verification work again (#13936) 2022-11-23 10:51:54 +00:00
CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md (#7381) 2020-09-28 11:28:30 +02:00
CODING_GUIDELINES.md feat: migrate to docusaurus (#13471) 2022-10-10 14:01:53 +00:00
CONTRIBUTING.md ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
docker-compose.yml build: add remote debugging with delve (#10587) 2021-12-01 12:44:54 +00:00
Dockerfile build(deps): bump go minimum version to go 1.19 (#13397) 2022-09-27 21:02:02 +02:00
go.mod build(deps): Bump google.golang.org/grpc from 1.50.1 to 1.51.0 (#13953) 2022-11-21 17:46:07 +01:00
go.sum build(deps): Bump google.golang.org/grpc from 1.50.1 to 1.51.0 (#13953) 2022-11-21 17:46:07 +01:00
go.work.example ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
LICENSE chore: update license copyright (#12542) 2022-07-13 10:19:10 +00:00
Makefile ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
README.md ci: configure sonarcloud (#13921) 2022-11-18 15:14:49 +00:00
RELEASE_PROCESS.md docs: add documentation on documentation deployment (#13739) 2022-11-03 17:23:52 +01:00
SECURITY.md docs: updates outdated docs (#12014) 2022-05-31 08:59:38 -04:00
sonar-project.properties ci: configure monorepo sonarcloud (#13944) 2022-11-23 10:47:18 +00:00
UPGRADING.md chore: rename app_legacy & add sims for 0.47 (#13950) 2022-11-21 18:11:37 +00:00

Cosmos SDK

banner

The Cosmos SDK is a framework for building blockchain applications. Tendermint Core (BFT Consensus) and the Cosmos SDK are written in the Go programming language. Cosmos SDK is used to build Gaia, the implementation of the Cosmos Hub.

WARNING: The Cosmos SDK has mostly stabilized, but we are still making some breaking changes.

Note: Requires Go 1.19+

Quick Start

To learn how the Cosmos SDK works from a high-level perspective, see the Cosmos SDK High-Level Intro.

If you want to get started quickly and learn how to build on top of Cosmos SDK, visit Cosmos SDK Tutorials. You can also fork the tutorial's repository to get started building your own Cosmos SDK application.

For more information, see the Cosmos SDK Documentation.

Contributing

See CONTRIBUTING.md for details on how to contribute and participate in our dev calls. If you want to follow the updates or learn more about the latest design then join our Discord.

Tools and Frameworks

The Cosmos ecosystem is vast. Awesome Cosmos is a community-curated list of notable frameworks, modules and tools.

Cosmos Hub Mainnet

The Cosmos Hub application, gaia, has its own cosmos/gaia repository. Go there to join the Cosmos Hub mainnet and more.

Inter-Blockchain Communication (IBC)

The IBC module for the Cosmos SDK has its own cosmos/ibc-go repository. Go there to build and integrate with the IBC module.

Ignite CLI

Ignite CLI is the all-in-one platform to build, launch, and maintain any crypto application on a sovereign and secured blockchain. If you are building a new app or a new module, use Ignite CLI to get started and speed up development.

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.