|
|
|
|
|
by emj
3137 days ago
|
|
About as fast as numpy.. More tools to create fast code is always great, but the tooling for Rust/C in Python needs to be easier, I just can't be bothered most of the time. This in numpy gets a better relative boost on my machine YMMV. import numpy
def count_double_chars_np(val):
ng=np.fromstring(val,dtype=np.byte)
return np.sum(ng[:-1]==ng[1:])
def test_np(benchmark):
benchmark(count_double_chars_np, val)
|
|