c: benchmark added and library code optimized for worstcase.