min-sized-rust VS smartstring

Compare min-sized-rust vs smartstring and see what are their differences.

min-sized-rust

🦀 How to minimize Rust binary size 📦 (by johnthagen)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
min-sized-rust smartstring
101 7
7,431 481
- -
6.2 0.0
about 1 month ago 7 months ago
Rust Rust
MIT License Mozilla Public License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

min-sized-rust

Posts with mentions or reviews of min-sized-rust. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-02-18.
  • The Linux Kernel Prepares for Rust 1.77 Upgrade
    9 projects | news.ycombinator.com | 18 Feb 2024
    This is a good guide on building small Rust binaries: https://github.com/johnthagen/min-sized-rust

    This talks about going to extreme lengths on making the smallest Rust binary possible, 400 bytes when it was written, https://darkcoding.net/software/a-very-small-rust-binary-ind...

    The thing is, you lose a lot of nice features when you do this, like panic unwinding, debug symbols, stdlib… for kernel and some embedded development it’s definitely important, but for most use cases, does it matter?

  • Rust wont save us, but its ideas will
    1 project | news.ycombinator.com | 9 Feb 2024
    Oh it was 137, haha. I will link you to this older comment of mine: https://news.ycombinator.com/item?id=29408906

    See also https://github.com/johnthagen/min-sized-rust

  • Making Rust binaries smaller by default
    8 projects | news.ycombinator.com | 23 Jan 2024
    Are you sure? If so then this is awesome news, but I'm a bit confused; the commit in that min-sized-rust repo adding `build-std` to the README was merged in August 2021: https://github.com/johnthagen/min-sized-rust/pull/30

    Are you saying that at that point the feature still hadn't "landed in Rust nightly" until recently? If so then what's the difference between a feature just being available in Rust nightly, vs having "landed"?

  • Was Rust Worth It?
    18 projects | news.ycombinator.com | 25 Oct 2023
    Rust binaries are by default nowhere close to 500MB. If they are not small enough for you, you can try https://github.com/johnthagen/min-sized-rust. By avoiding the formatting machinery and using `panic_immediate_abort` you can get about the size of C binaries.
  • Compiling Rust binaries for Windows 98 SE and more: a journey
    1 project | news.ycombinator.com | 9 Oct 2023
    A useful reference: https://github.com/johnthagen/min-sized-rust
  • How to minimize Rust binary size
    1 project | news.ycombinator.com | 23 Aug 2023
    1 project | news.ycombinator.com | 9 Jul 2023
  • Error on flashing embedded code to stm32f103
    2 projects | /r/rust | 10 Jul 2023
  • Tiny Binaries (2021)
    1 project | news.ycombinator.com | 16 Jun 2023
    That must be without stripping. Also there are ways to reduce binary size. See e.g. [min-sized-rust](https://github.com/johnthagen/min-sized-rust). I've gotten stripped binaries of small cli utils less than 400KiB without doing anything special, less than 150 KiB by customizing profile settings and compressing with upx, and less than 30 KiB by replacing the std with the libc as the link shows. Haven't tried with fltk though...
  • Shared libraries
    2 projects | /r/rust | 30 May 2023
    This is not quite what you're asking, but it does also address the underlying concern: https://github.com/johnthagen/min-sized-rust

smartstring

Posts with mentions or reviews of smartstring. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-08-14.
  • Does using "String" instead of "&str" a lot results in unoptimised code?
    3 projects | /r/rust | 14 Aug 2022
    Your use case sounds like it will involve a lot of small strings that use a subset of UTF-8. If you’re concerned about performance, you could look into something like smartstring. Sixbit also looks interesting, but it looks like it won’t give you any more characters and it’d probably require additional computation to do the conversion (and they’d have to be converted back out).
  • Rust Is Hard, Or: The Misery of Mainstream Programming
    15 projects | news.ycombinator.com | 2 Jun 2022
    > If you have a long-running async function, then pass parameters by value! If you have a polymorphic async function, then return your result in a Box.

    I've taken to making heavy use of the smallvec and smartstring crates for this. Most lists and strings are small in practice. Using smallvec / smartstring lets you keep most clone() calls allocation-free. This in turn lets you use owned objects, which are easier to reason about - for you and the borrow checker. And you keep a lot of the performance of just passing around references.

    I tried to use async rust a couple of years ago, and fell on my face in the process. Most of my rust at the moment is designed to compile to wasm - and then I'm leaning on nodejs for networking and IO. Writing async networked code is oh so much easier to reason about in javascript. When GAT, TAIT and some other language features to fix async land I'll muster up the courage to make another attempt. But rust's progress at fixing these problems feels painfully slow.

    https://crates.io/crates/smallvec / https://crates.io/crates/smartstring

  • GitHub - epage/string-benchmarks-rs: Comparison of Rust string types
    3 projects | /r/rust | 25 Mar 2022
    Just to point out, smartstring no longer assumes String memory layout. From the changelog:
  • Why is str not just [char]?
    2 projects | /r/rust | 25 Oct 2021
    There's some really good crates that implement SSO floating around - eg, SmartString. But I agree - its a pity they're needed. Swift built this into the core string type in the language. I think that was the right call.
  • Announcing `compact_str`! A super memory efficient immutable string that is transparently stored on the stack, when possible
    5 projects | /r/rust | 19 Sep 2021
    Comparatively: * SmolStr can inline up to 22 bytes but does not adjust down for 32-bit architectures, meaning it's potentially wasting memory on 32-bit archs. Similarly though it's immutable and Clone is O(1) * SmartString can inline up to 23 bytes, but it's mutable and Clone is O(n). Also this crate makes assumptions about the memory layout of a String, which in theory should be fine, but is a slight caveat.
  • Version 0.19.15 released.
    1 project | /r/Rhai | 31 Mar 2021
    SmartString is used to store identifiers (which tends to be short, fewer than 23 characters, and ASCII-based) because they can usually be stored inline. Map keys now also use SmartString.
  • Speed of Rust vs. C
    17 projects | news.ycombinator.com | 12 Mar 2021
    I’ve been using smartstrings, which is both excellent and maintained. https://github.com/bodil/smartstring

What are some alternatives?

When comparing min-sized-rust and smartstring you can also consider the following projects:

Cargo - The Rust package manager

smol_str

rustc_codegen_gcc - libgccjit AOT codegen for rustc

compact_str - A memory efficient string type that can store up to 24* bytes on the stack

c2rust - Migrate C code to Rust

libskry_r - Lucky imaging library

regex - An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.

bitter - Extract bits from a byte slice

embedded-graphics - A no_std graphics library for embedded applications

redgrep - ♥ Janusz Brzozowski

tiny-rust-executable - Using Rust to make a 137-byte static AMD64 Linux executable

fst - Represent large sets and maps compactly with finite state transducers.