improved speed of discrete/quantized versions, added benchmark