johnthagen / johnthagen/min-sized-rust

Add note about monomorphisation

Open
#24 6 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.8k
Forks
247
PR merge metrics
No merged PRs in 30d

Description

Generics with static dispatch can lead to duplicated functions, and if they are big enough, it will make for a large piece of the final binary.

Alternatives are dynamic dispatch with `dyn`, or just removing generic code.

Is seems very important for minimizing binary size.

(If you don't want to change the function API, **and** the function is being generic over something like `AsRef`, you can also create helper function which resolves `path.as_ref()` and calls a non-generic function that receives `&Path` instead.)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.