# Rust / Julia Comparison Post

**URL:** <https://discourse.julialang.org/t/rust-julia-comparison-post/75403>\
**Category:** Performance\
**Tags:** rust\
**Created:** [January 29, 2022, 1:45am UTC](https://discourse.julialang.org/t/rust-julia-comparison-post/75403 "2022-01-29T01:45:37Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [January 29, 2022, 4:41pm UTC](https://discourse.julialang.org/t/rust-julia-comparison-post/75403/21 "2022-01-29T16:41:10Z")

</div>

> [@stevengj](#):
>
> This is crazy, why are you using vectors of `Char` to work with strings?

Important observation: because the hot loops

```julia
constraint.letter ∉ word
constraint.letter ∈ word

```

seem to be way faster for `Vector{Char}` than for `String`. Quick example

```julia
julia> x = "salet"
"salet"

julia> @btime in('t', $x)
  14.930 ns (0 allocations: 0 bytes)
true

julia> x = Vector{Char}("salet")
5-element Vector{Char}:
 's': ASCII/Unicode U+0073 (category Ll: Letter, lowercase)
 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
 'l': ASCII/Unicode U+006C (category Ll: Letter, lowercase)
 'e': ASCII/Unicode U+0065 (category Ll: Letter, lowercase)
 't': ASCII/Unicode U+0074 (category Ll: Letter, lowercase)

julia> @btime in('t', $x)
  3.200 ns (0 allocations: 0 bytes)
true

```

---

_[View the full topic](https://discourse.julialang.org/t/rust-julia-comparison-post/75403)._
