Igor V Belousov <[email protected]> writes:
> Hi,
> I'm modify code in punycode.c for faster run.
Hi. Thanks for looking at the code. Can you explain a bit more about:
1) How much faster is the code, in what kind of benchmark?
2) How the change is guaranteed to not change semantics? Where do the
magic values 455 and 35 come from?
/Simon
> --- punycode_old.c 2013-10-29 11:13:31.000000000 +0400
> +++ punycode.c 2013-10-29 11:13:43.000000000 +0400
> @@ -146,12 +146,12 @@
> /* delta >> 1 is a faster way of doing delta / 2 */
> delta += delta / numpoints;
>
> - for (k = 0; delta > ((base - tmin) * tmax) / 2; k += base)
> + for (k = 0; delta > 455; k += base) //faster way
> {
> - delta /= base - tmin;
> + delta /= 35;//faster way
> }
>
> - return k + (base - tmin + 1) * delta / (delta + skew);
> + return k + base * delta / (delta + skew);// base - tmin + 1 = base - 1 + 1
> }
>
> /*** Main encode function ***/
>
> Sorry bad English.
> Igor V Belousov.
>
>
> _______________________________________________
> Help-libidn mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/help-libidn
_______________________________________________
Help-libidn mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-libidn