In perl.git, the branch smoke-me/khw-new_locale has been created

<http://perl5.git.perl.org/perl.git/commitdiff/aba04e94215919a9f35e9481c4289f7a9f30e057?hp=0000000000000000000000000000000000000000>

        at  aba04e94215919a9f35e9481c4289f7a9f30e057 (commit)

- Log -----------------------------------------------------------------
commit aba04e94215919a9f35e9481c4289f7a9f30e057
Author: Karl Williamson <[email protected]>
Date:   Fri May 13 11:32:44 2016 -0600

    locale.c: Make locale collation predictions adaptive
    
    We try to avoid calling strxfrm() more than needed by predicting its
    needed buffer size.  This generally works because the size of the
    transformed string is roughly linear with the size of the input string.
    But the key word there is "roughly".  This changes things, so that when
    we guess low, we change the constants in the equation to guess higher
    the next time.

M       locale.c

commit 9bb7503da92bcb42e902f7116bd677e98ddaee4f
Author: Karl Williamson <[email protected]>
Date:   Tue Apr 12 14:28:57 2016 -0600

    locale.c: Not so aggressive collation memory use guess
    
    On platforms where  strxfrm() is not well-behaved, and it fails because
    it needs a larger buffer, prior to this commit, the size was doubled
    before trying again.  This could require a lot of memory on large
    inputs.  I'm uncomfortable with such a big delta on very large strings.
    This commit changes it so it is not so aggressive.  Note that this now
    only gets called on platforms whose strxfrm() is not well behaved, and I
    think the size prediction is better due to a recent commit, and there
    isn't really much of a downside in not gobbling up memory so fast.

M       locale.c

commit 6a0039989de59f6e0961a89d851f5e5d8fb8e8fc
Author: Karl Williamson <[email protected]>
Date:   Tue Apr 12 14:26:53 2016 -0600

    locale.c: Add some debugging statements

M       locale.c

commit cd5cfae8ec96c7486818b248b7ec14edc1d1d371
Author: Karl Williamson <[email protected]>
Date:   Sat May 14 18:23:33 2016 -0600

    locale.c: Minor cleanup
    
     This replaces an expression with what I think is an easier to
     understand macro, and eliminates a couple of temporary variables that
     just cluttered things up.

M       locale.c

commit b0ee945fa58b2b352989f1422a9deabbf7b03292
Author: Karl Williamson <[email protected]>
Date:   Sat May 14 18:23:02 2016 -0600

    locale.c: Fix some debugging so will output during init
    
    Because the command line options are currently parsed after the locale
    initialization is done, an environment variable is read to allow
    debugging of the function that is called to do the initialization.
    However, any functions that it calls, prior to this commit, were unaware
    of this and so did not output debugging.  This commit fixes most of
    them.

M       locale.c

commit bd4c269722b40fd8a794f7557d0828751636449f
Author: Karl Williamson <[email protected]>
Date:   Tue Apr 12 12:49:36 2016 -0600

    mv function from locale.c to mathoms.c
    
    The previous commit causes this function being moved to be just a
    wrapper not called in core.  Just in case someone is calling it, it is
    retained, but moved to mathoms.c

M       embed.fnc
M       embed.h
M       locale.c
M       mathoms.c
M       proto.h

commit c75bcff3bf26c97086d86204dcd5d7baa5fb8ea5
Author: Karl Williamson <[email protected]>
Date:   Tue Apr 12 12:17:48 2016 -0600

    Do better locale collation in UTF-8 locales
    
    strxfrm() works reasonably well on some platforms under UTF-8 locales.
    It will assume that every string passed to it is in UTF-8.  This commit
    changes perl to make sure that strxfrm's expectations are met.
    
    Likewise under a non-UTF-8 locale, strxfrm is expecting a non-UTF-8
    string.   And this commit makes sure of that.  If the passed string
    contains code points representable only in UTF-8, they are changed into
    the highest collating code point that doesn't require UTF-8.  This
    provides seamless operation, as they end up collating after every
    non-UTF-8 code point.  If two transformed strings compare equal, perl
    already uses the un-transformed versions to break ties, and there, these
    faked-up strings will collate after everything else, and in code point
    order amongst themselves.

M       embed.fnc
M       embed.h
M       embedvar.h
M       intrpvar.h
M       lib/locale.t
M       locale.c
M       pod/perldelta.pod
M       pod/perllocale.pod
M       proto.h
M       sv.c

commit 9e8c901a4be9f102099c2e43ba76b232490d7b2a
Author: Karl Williamson <[email protected]>
Date:   Tue Apr 12 13:51:48 2016 -0600

    perllocale: Change headings so two aren't identical
    
    Two html anchors in this pod were identical, which isn't a problme
    unless you try to link to one of them, as the next commit does

M       pod/perllocale.pod

commit c7df055f52f7687ec7e4fdf46fddca56aefd1111
Author: Karl Williamson <[email protected]>
Date:   Tue Apr 12 11:21:40 2016 -0600

    Change calculation of locale collation constants
    
    Every time a new collation locale is set, two constants are calculated
    that are used in predicting how much space is needed in the
    transformation of a string by strxfrm().  The transformed string is
    roughly linear with the the length of the input string, so we are
    calcaulating 'm' and 'b' such that
    
        transformed_length = m * input_length + b
    
    Space is allocated based on this prediction.  If it is too small, the
    strxfrm() will fail, and we will have to increase the allotted amount
    and try again.  It's better to get the prediction right to avoid
    multiple, expensive strxfrm() calls.
    
    Prior to this commit, the calculation was not rigorous, and failed on
    some platforms that don't have a fully conforming strxfrm().
    
    This commit changes to not panic if a locale has an apparent defective
    collation, but instead silently ignores it.  It could be argued that a
    warning should instead be raised.
    
    This commit fixes [perl #121734].

M       locale.c
M       pod/perldelta.pod

commit dd0c3bb99e6428afaed3a3272097e85fa19afef8
Author: Karl Williamson <[email protected]>
Date:   Mon Apr 11 19:11:07 2016 -0600

    locale.c: Change algorithm for strxfrm() trials
    
    It's kind of guess work deciding how big a buffer to give to strxfrm().
    If you give it too small a one, it will fail.  Prior to this commit, the
    buffer size was doubled and then strxfrm() was called again, looping
    until it worked, or we used too much memory.
    
    Each time a new locale is made, we try to minimize the necessity of
    doing this by calculating numbers 'm' and 'b' that can be plugged into
    the equation
    
        mx + b
    
    where 'x' is the size of the string passed to strxfrm().  strxfrm() is
    roughly linear with respect to its input's length, so this generally
    works without us having to do many loops to get a large enough size.
    
    But on many systems, strxfrm(), in failing, returns how much space you
    should have given it.  On such systems, we can just use that number on
    the 2nd try and not have to keep guessing.  This commit changes to do
    that.
    
    But on other systems this doesn't work.  So the original method is
    retained if we determine that there are problems with strxfrm(), either
    from previous experience, or because using the size returned from the
    first trial didn't work

M       embedvar.h
M       intrpvar.h
M       locale.c

commit b70ddfba76527c2da81961b955dc4ad160a4c9e3
Author: Karl Williamson <[email protected]>
Date:   Sat Apr 9 20:40:48 2016 -0600

    locale.c: Free over-allocated space early
    
    We may over malloc some space in buffers to strxfrm().  This frees it
    now instead of waiting for the whole block to be freed sometime later.
    This can be a significant amount of memory if the input string to
    strxfrm() is long.

M       locale.c

commit 1403091d38ecfaf0067630b48db5f74d23810e88
Author: Karl Williamson <[email protected]>
Date:   Sat Apr 9 20:36:01 2016 -0600

    locale.c:  White-space only
    
    Outdent and reflow because the previous commit removed an enclosing
    block.

M       locale.c

commit ddd1c661f2c5ffa62b9100236fac1dbef372c058
Author: Karl Williamson <[email protected]>
Date:   Sat Apr 9 15:52:05 2016 -0600

    Change mem_collxfrm() algorithm for embedded NULs
    
    Perl uses strxfrm() to handle collation.  This C library function
    expects a NUL-terminated input string.  But Perl accepts interior NUL
    characters, so something has to happen.
    
    Until this commit, what happened was that each NUL-terminated
    sub-segment would be individually passed to strxfrm(), with the results
    concatenated together to form the transformation of the whole string
    with NULs ignored.  But this isn't guaranteed to give good results, as
    strxfrm() is highly context sensitive, and needs the whole string, not
    partial segments, to work properly.  The way strxfrm() works, more or
    less,  is that it returns a string consisting of the primary weights, in
    order, of the characters of the input, concatenated with the secondary
    weights, and so on.  Giving strxfrm() only substrings defeats this.
    
    Another possibility would be to just remove the NULs before transforming
    the string.  The problem with this method is that it screws up the
    context.  In some locales, two adjacent characters can behave
    differently than if they were separated.
    
    What this commit does is to change to replace each NUL with a \001.
    \001 is almost certainly going to behave like we expect a NUL would if
    it were legal.  Just about every locale treats low code points as
    controls, to be ignored in at least primary weighting.
    
    And this method gives the expected sort order.  This is because perl
    uses the original strings as a tie breaker.  So, given two strings, one
    that originally had \001, and one that differed only in that it had \000
    instead, they both will get transformed to be identical, so will sort
    equal there, but the tie breaker will cause the one with NULs to sort
    first.
    
    As stated in the new code comments, we could go through the first 256
    code points to determine the lowest collating one, instead of assuming
    it is \001.  But this is a lot of work (UTF-8ness must be considered)
    and it will be extremely rare that the answer isn't going to be \001.

M       embed.fnc
M       lib/locale.t
M       locale.c
M       proto.h

commit cf5a647268c1d266bdd0406dedf839181f64c001
Author: Karl Williamson <[email protected]>
Date:   Fri May 13 11:51:55 2016 -0600

    lib/locale.t: Don't calculate value unless needed

M       lib/locale.t
-----------------------------------------------------------------------

--
Perl5 Master Repository

Reply via email to