Skip to content

Performance

Zibi Braniecki edited this page Aug 10, 2019 · 12 revisions

Performance

Performance has been tested on MacBook Pro 2017, using Rust 1.36 and tinystr 0.1.0.

FromStr
  • 4 char max:
    • String: 1.0779 us
    • TinyStr4: 25.999 ns
    • TinyStr8: 104.81 ns
  • 8 char max:
    • String: 1.0864 us
    • TinyStr8: 107.37 ns
to_ascii_lowercase
  • 4 char max:
    • String: 1.1313 us
    • TinyStr4: 20.164 ns
    • TinyStr8: 28.205 ns
  • 8 char max:
    • String: 1.1442 us
    • TinyStr8: 28.211 ns
to_ascii_uppercase
  • 4 char max:
    • String: 1.1282 us
    • TinyStr4: 20.982 ns
    • TinyStr8: 24.347 ns
  • 8 char max:
    • String: 1.1420 us
    • TinyStr8: 24.327 ns
to_ascii_titlecase
  • 4 char max:
    • String: 1.1487 us
    • TinyStr4: 24.566 ns
is_ascii_alphanumeric
  • 4 char max:
    • String: 35.767 ns
    • TinyStr4: 21.027 ns
    • TinyStr8: 32.094 ns
  • 8 char max:
    • String: 45.881 ns
    • TinyStr8: 32.094 ns

Performance vs. istring 0.1.13, smol_str 0.1.12, smallstr 0.1.0

FromStr
  • 4 char max:
    • SmolStr: 182.33 ns
    • smallstr: 12.833 ns
    • istring: 155.55 ns
    • String: 1.0956 us
    • TinyStr4: 25.774 ns
    • TinyStr8: 101.39 ns
  • 8 char max:
    • SmolStr: 184.60 ns
    • smallstr: 12.651 ns
    • istring: 156.42 ns
    • String: 1.0929 us
    • TinyStr8: 104.22 ns

For all other operations, SmolStr, smallstr and istring has performance comparable to String.

Clone this wiki locally