//Buffer for improved performance (avoid repeated heap allocations)
letmutstarting_consonants_buffer=String::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
letmutstarting_consonants_buffer=Vec::<u8>::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
//Indexes for improved performance (avoid copying characters to use as the english_word argument for translate_word_with_style_reuse_buffers)
//However, this assumes each character is one byte, so this only works with ASCII strings
letmutpig_latin_word=String::with_capacity(64*2);//Longer than all English words to avoid unneeded allocations, times 2 to leave room for whitespace, symbols, and the suffix
letmutstarting_consonants_buffer=String::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
letmutstarting_consonants_buffer=Vec::<u8>::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
letmutpig_latin_word=String::with_capacity(64*2);//Longer than all English words to avoid unneeded allocations, times 2 to leave room for whitespace, symbols, and the suffix
letmutstarting_consonants_buffer=String::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
letmutstarting_consonants_buffer=Vec::<u8>::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
b.iter(||{
letword=test::black_box("translator");
@ -403,7 +481,7 @@ mod benches {
#[bench]
fnascii_yay_the_word_translator(b: &mutBencher){
letmutpig_latin_word=String::with_capacity(64*2);//Longer than all English words to avoid unneeded allocations, times 2 to leave room for whitespace, symbols, and the suffix
letmutstarting_consonants_buffer=String::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
letmutstarting_consonants_buffer=Vec::<u8>::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
b.iter(||{
letword=test::black_box("translator");
@ -423,7 +501,7 @@ mod benches {
#[bench]
fnascii_hay_the_word_translator(b: &mutBencher){
letmutpig_latin_word=String::with_capacity(64*2);//Longer than all English words to avoid unneeded allocations, times 2 to leave room for whitespace, symbols, and the suffix
letmutstarting_consonants_buffer=String::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
letmutstarting_consonants_buffer=Vec::<u8>::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
b.iter(||{
letword=test::black_box("translator");
@ -443,7 +521,7 @@ mod benches {
#[bench]
fnascii_ferb_the_word_translator(b: &mutBencher){
letmutpig_latin_word=String::with_capacity(64*2);//Longer than all English words to avoid unneeded allocations, times 2 to leave room for whitespace, symbols, and the suffix
letmutstarting_consonants_buffer=String::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word
letmutstarting_consonants_buffer=Vec::<u8>::with_capacity(64);//Longer than basically all English words to avoid unneeded allocations, plus the fact that this isn't the whole word