• ###### henninglivecommented on "Number of Decimal Digits" kata

yes, sorry about that. I forgot that naming convention was different than in C#. I am not sure it is worth fixing since it will brake all the submitted solutions.

• ###### henninglivecommented on "Number of Decimal Digits" csharp solution

A log10 solution wouldn’t work anyway because a double is limited to 53bit of precision. For larger numbers, there would be rounding errors. That’s assuming log10 has 53bit of precision, which is probably not true.

• ###### henninglivecommented on "Number of Decimal Digits" csharp solution

Assuming n values are randomly distributed, the probabilities for each case will be logarithmically distributed, where 20 is most likely. Reversing the comparisons should therefore be faster.

• ###### henningliveresolved an issue on "Number of Decimal Digits" kata

I am marking this as resolved.

• ###### henninglivecommented on "Number of Decimal Digits" rust solution

I did a simple benchmark with randomly generated numbers comparing the different implementations and different unsigned integer types. The unrolling did improve performance for most types, but not u128.

Description u16(ns/iter) u32(ns/iter) u64(ns/iter) u128(ns/iter)
Unrolled binary search 2,838 (+/- 753) 2,200 (+/- 365) 2,885 (+/- 249) 4,112 (+/- 320)
Leading zeros and lookup 7,807 (+/- 9,575) 3,214 (+/- 543) 2,885 (+/- 489) 7,068 (+/- 813)
Div loop 5,580 (+/- 812) 12,681 (+/- 1,044) 34,353 (+/- 3,246) 1,196 (+/- 127)
Div loop unrolled 2,566 (+/- 1,903) 5,499 (+/- 630) 11,697 (+/- 1,154) 1,148 (+/- 40)
Log10 19,931 (+/- 3,046) 20,865 (+/- 3,740) 21,033 (+/- 2,810) 53,130 (+/- 5,023)
Match range Lookup 2,387 (+/- 996) 4,271 (+/- 579) 8,222 (+/- 3,483) 1,275 (+/- 513)
Mul loop 2,406 (+/- 2,580) 4,472 (+/- 1,442) 8,305 (+/- 939) 2,337 (+/- 2,926)
String format heap 116,225 (+/- 21,677) 127,343 (+/- 66,637) 128,449 (+/- 11,434) 183,756 (+/-,126,726)
String format stack 49,998 (+/- 5,560) 55,585 (+/- 10,823) 67,626 (+/- 18,414) 47,958 (+/- 4,811)
• ###### henninglivecommented on "Number of Decimal Digits" kata

I have updated the description. Is it ok now?