groovy
  1. groovy
  2. GROOVY-3246

There should be a DGM.normalize(String) method which acts like readLines().join('\n')

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6-rc-2, 1.5.8, 1.7-beta-1
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      7
    1. DefaultGroovyMethods.diff
      3 kB
      Alexander Veit
    2. DefaultGroovyMethodsTest.diff
      3 kB
      Alexander Veit
    3. DGM-denormalize.txt
      1 kB
      Alexander Veit
    4. DGM-normalize.txt
      0.7 kB
      Alexander Veit
    5. DGMTest-denormalize.txt
      1 kB
      Alexander Veit
    6. DGMTest-normalize.txt
      1 kB
      Alexander Veit
    7. improve-normalization-patch.txt
      5 kB
      Jim White

      Issue Links

        Activity

        Hide
        Jim White added a comment -

        I would like normalize to be string-based and to not change whether there is a final line ending.

        Show
        Jim White added a comment - I would like normalize to be string-based and to not change whether there is a final line ending.
        Hide
        Jim White added a comment -

        Patch for the trunk to make normalize and denormalize be string-based and which tighter semantics. Test cases updated.

        Show
        Jim White added a comment - Patch for the trunk to make normalize and denormalize be string-based and which tighter semantics. Test cases updated.
        Hide
        Jim White added a comment -

        Committed to trunk (cs15032). If there is no objection then I'll push this into the other branches.

        Show
        Jim White added a comment - Committed to trunk (cs15032). If there is no objection then I'll push this into the other branches.
        Hide
        Alexander Veit added a comment -

        The results seem to be fine now

        However the implementation is quite slow now. In my tests normalize is up to factor 25 slower than a character based single-pass implementation (patch from http://jira.codehaus.org/browse/GROOVY-3264). RegExes are expensive.

        Show
        Alexander Veit added a comment - The results seem to be fine now However the implementation is quite slow now. In my tests normalize is up to factor 25 slower than a character based single-pass implementation (patch from http://jira.codehaus.org/browse/GROOVY-3264 ). RegExes are expensive.
        Hide
        Jim White added a comment - - edited

        Yeah, I was afraid of that. But if we now agree on this API, speed tuning would be worthwhile.

        If you want to update your patch, that would be dandy.

        It would also be nice to know how much difference precompiling the patterns makes.

        Show
        Jim White added a comment - - edited Yeah, I was afraid of that. But if we now agree on this API, speed tuning would be worthwhile. If you want to update your patch, that would be dandy. It would also be nice to know how much difference precompiling the patterns makes.
        Hide
        Alexander Veit added a comment -

        Attached alternative implementations and a patch for the 1_6_X branch.

        Show
        Alexander Veit added a comment - Attached alternative implementations and a patch for the 1_6_X branch.
        Hide
        Alexander Veit added a comment -

        Attachments (continued).

        Show
        Alexander Veit added a comment - Attachments (continued).
        Hide
        Jim White added a comment - - edited

        I've committed (trunk first - cs15089 - branches later) tuned up versions of normalize and denormalize. I've used somewhat different logic and there are a couple comments explaining that.

        Also I didn't use the tests because there already are some in groovy.StringTest.groovy. If there are any cases missing from there, please do add them there.

        Thanks for your help!

        Show
        Jim White added a comment - - edited I've committed (trunk first - cs15089 - branches later) tuned up versions of normalize and denormalize . I've used somewhat different logic and there are a couple comments explaining that. Also I didn't use the tests because there already are some in groovy.StringTest.groovy . If there are any cases missing from there, please do add them there. Thanks for your help!

          People

          • Assignee:
            Paul King
            Reporter:
            Paul King
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: