Closed oscbyspro closed 2 days ago
The GCD of a Fibonacci sequence pair is not the best thing to benchmark, but still.
But Ultimathnum.UXL is a bit faster than Numberick.UIntXL :smiley:
I profiled it and discovered that the integer literals are slow :rofl:
Edit: Ultimathnum.U256 is faster if I set its integer literal to Int.
A) Swift.Int
literal takes it to ~300ms.
B) RootInt/entropy() <= IX.size
fast path takes it to ~400ms.
I suppose another way of solving is by meticulously calling fast initializers instead of using integer literals, but that would be a downgrade in terms of ergonomics. It's just so silly that integer literals may resolve at runtime.
Turns out that there's still some division improvements to make too. Instead of:
normalization.value >= Base.size // normalization is Shift<Self>
I can guard-cast it to a half-shift and then continue by using half-shift methods:
guard let normalization = Shift<Base>(exactly: normalization.value) else { ... }
Hm. I can get to ~340ms by writing things like: init(load: 0 as Element.Magnitude)
.
I changed the integer literal type to Element.IntegerLiteralType for the time being.
So I wanted to see the difference (#31) makes on DoubleInt, and the difference is great. Then I compared it against my predecessor project and that one still performs divisions faster. Sigh. I haven't yet gotten around to optimizing the new abstraction, although I suppose (#31) is a step in the right direction.
Edit: Ultimathnum.U256 is faster if I set its integer literal to Int or Element.