Artichoke uses SIMD vectorization in some APIs, like checking for the presence of NUL bytes in Strings passed to Kernel::require and ENV#[]=. #performance #memchr #simd #vectorization #rustlang
-
Show this thread
-
Bench: a = 'a' * LEN a[-1] = "\0" 1_000.times { begin; ENV["FOO"] = a; rescue; nil; end }
#performance#benchmark#ruby1 reply 0 retweets 2 likesShow this thread -
When LEN is small, VM speed dominates. Artichoke's mruby backend is slower than YARV. With LEN = 1024, Artichoke is ~8x slower than MRI.
#performance#optimization#artichoke#rustlang#ruby1 reply 0 retweets 1 likeShow this thread -
As LEN increases, more time is spent in native code for the NUL check. With LEN = 2 ** 30, Artichoke is as fast as MRI, despite a slower VM.
#performance#optimization#artichoke#rustlang#ruby1 reply 0 retweets 1 likeShow this thread -
Shout out to
@burntsushi5 for the memchr crate and the code for std::ffi::CString which showed how easy it was to use it.#rustlang#crate1 reply 0 retweets 2 likesShow this thread -
Another optimization is to use
#memchr for String#scan for patterns 3 bytes or less.#performance#optimization#artichoke2 replies 0 retweets 1 likeShow this thread -
Replying to @artichokeruby
You might want to check out bstr's substring search algorithm for optimizations in this style!
1 reply 0 retweets 2 likes -
Replying to @burntsushi5
bstr is great! I’m using it to serialize byte slices into exception messages. While we’re here, I’d love a method on &BStr to get the Debug String without the quotes.
1 reply 0 retweets 1 like
Please file an issue with an example. :) I try not to take feature requests over Twitter.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.