paritytech / paritytech/parity-scale-codec

Inline trivial implementations

Open
#728 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
287
Forks
103
Avg merge
6d 13h
Merged PRs (30d)
1

Description

There are many trivial methods in the code that should be inlined (which will help compiler to generate better code).

Especially in cases like this:
https://github.com/paritytech/parity-scale-codec/blob/0a0295a465ac40fd2d38359220fdcc3f3de94cae/src/codec.rs#L1545-L1547

This is essentially a const method, #[inline(force)] it will reduce the call and corresponding .unwrap() to a constant.

I wanted to submit such a change, but turned out code has a huge number of trivial methods and I wasn't in a mood to do invasive changes.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/codec.rs around lines 1545-1547, then inventory other trivial methods in the repository. Determine which methods fit the proposed #[inline(force)] treatment; done means the agreed set is consistently inlined without unrelated invasive changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.