o-jill / ruversi

reversi program.
https://o-jill.github.io/ruversi/
1 stars 0 forks source link

rfen文字列生成の高速化 #126

Closed o-jill closed 8 months ago

o-jill commented 8 months ago

同じ文字列から繰り返し文字を取得する場合 https://rs.nkmk.me/rust-str-nth-char/#h2_3

let s: &str = "xyz<123>";

let bytes: &[u8] = s.as_bytes();
assert_eq!(*bytes.get(2).unwrap() as char, 'z');
assert_eq!(*bytes.get(5).unwrap() as char, '2');
o-jill commented 8 months ago

有意差が出るほど速くならなかったけどコードの整理にはなった。 127d27d8