Skip to content
Tcl Source Code History Of Ticket 3396731
Login

History Of Ticket 3396731

Artifacts Associated With Ticket 3396731

  1. Ticket change [0b853849d2] (rid 114003) by nijtmans on 2011-08-23 06:59:42:

    1. assignee initialized to: "nijtmans"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      The TclStringObjReverse function (in tclStringObj.c) does
      a complicated job: If the object contains no unicode, the
      reverse is done in-place, but otherwise a Unicode string
      representation is formed and that is reversed in stead.
      
      Much simpler is: reverse the individual bytes from the
      UTF-8 characters first in-place, and then reverse the bytes
      of the whole string. The individual bytes of the UTF-8
      representation will then be correct again, and this
      can always be done inline.
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "nijtmans"
    10. subsystem initialized to: "44. UTF-8 Strings"
    11. title initialized to: "inline string reverse"
    12. type initialized to: "RFE"
  2. Ticket change [a2b2343165] (rid 109941) by nijtmans on 2011-08-23 14:19:36:

    1. closedate changed to: "2011-08-23T07:19:36"
    2. closer changed to: "nijtmans"
    3. icomment:
      Fixed in trunk [8ebe975003]
      
      
    4. login: "nijtmans"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "nijtmans"
  3. Ticket change [076360037f] (rid 89389) by dgp on 2011-08-23 23:35:16:

    1. icomment:
      
      Doesn't this change unnecessarily
      force the "string rep" generation of
      a pure Unicode value?  Loss of
      "pure Unicode" status can influence
      what code paths are available down
      the line.  Any impact measurement done?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [5ef31056ff] (rid 115725) by dgp on 2011-08-24 00:02:32:

    1. icomment:
      
      New branch revert-3396731 takes this
      patch back out.  With two branches differing
      only in this matter, we can make comparisons
      and decide which to keep.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  5. Ticket change [45059c190e] (rid 116808) by nijtmans on 2011-08-24 02:13:12:

    1. icomment:
      >Doesn't this change unnecessarily
      >force the "string rep" generation of
      >a pure Unicode value?
      It will be difficult to write a test case
      which does not - in the end - generate
      a string rep anyway.
      
      In-line reversal only does
      a single memory allocation, and
      only when the value is shared, so
      it will win from whatever other
      method.
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  6. Ticket change [194ef3fb3a] (rid 122789) by dgp on 2011-08-24 04:08:56:

    1. icomment:
      I'm not worried about the speed of the
      operation,.  I'm worried about the loss
      of "pure unicode" status which will change
      the optimizations available to subsequent
      operations on the value.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [0795aafc53] (rid 89428) by dgp on 2011-08-24 04:10:08:

    1. icomment:
      FWIW, I tried to measure the two branches
      with tclbench and proved again only one thing.
      I'm completely incapable of getting any usable
      information out of tclbench! ;P:P:P:P:P
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Ticket change [d2ded28fe1] (rid 113603) by dgp on 2011-08-24 04:15:02:

    1. icomment:
      003 ARRAY makeHash 500 50                40725.52 14465.44
      
      That sure looks like the change was a huge performance hit.
      I used -repeat 8 on an idle machine; surely that's enough for
      such a huge dispaity to be real?!
      But I dont' believe it.  Is a [reverse] operation even anywhere
      near this?  So then what?
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  9. Ticket change [7fae403b39] (rid 97599) by dgp on 2011-08-24 23:22:03:

    1. icomment:
      
      Ok, appears my botched performance attempts
      were attempting to compare two build that did not
      agree on their -DPURIFY settings. D'oh!!!
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  10. Ticket change [ccdad0231b] (rid 95776) by dgp on 2011-08-24 23:24:29:

    1. icomment:
      
      More successful attempt today better matches
      expectations.  On almost all benchmarks, no
      significant difference.  Only a few differences on
      the tests that measure the performance of the
      reverse operations that were changed:
      
      555 STR reverse core, 10 c                   1.29    1.32    1.00
      556 STR reverse core, 10 uc                  1.23    1.26    1.00
      557 STR reverse core, 100 c                  1.72    1.33    1.00
      558 STR reverse core, 100 uc                 1.67    1.24    1.00
      559 STR reverse core, 400 c                  2.86    1.29    1.00
      560 STR reverse core, 400 uc                 2.76    1.14    1.00
      
      Unfortunately, the news is not good for the new patch.
      Will pursue and followup with an explanation when I have one.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  11. Ticket change [1dc858a1ff] (rid 90872) by dgp on 2011-08-24 23:25:56:

    1. icomment:
      
      Column 1 = trunk
      Column 2 = revert branch
      Column 3 = 8.5 branch
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  12. Ticket change [5c41486eb9] (rid 115270) by dgp on 2011-08-25 00:08:55:

    1. icomment:
      
      The degraded benchmarks test the speed of
      
        string reverse [string range $long 1 $length]
      
      The [string range] returns a pure unicode value,
      so this is exactly the case we would expect to slow
      down with the change, which forces a string rep
      generation that was not done before.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  13. Ticket change [7772c06c7c] (rid 89777) by dgp on 2011-08-25 01:47:21:

    1. icomment:
      
      Semi-side comment... I'm not seeing any
      way at the moment for an unshared value
      to reach TclStringObjReverse().  We could
      be optimizing a case that never happens.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  14. Ticket change [9877fc8cee] (rid 110607) by dgp on 2011-08-25 01:52:28:

    1. assignee changed to: "dkf"
    2. icomment:
      
      Ok, it's a bit weird.
      [string reverse $foo] always reaches TclStringObjReverse() with $foo shared.
      [::tcl::string::reverse $foo] can get there unshared.
      
      This feels somewhat like an unwanted side effect of
      ensembles.  Bringing in dkf to comment on just that.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. username: "dgp"
  15. Ticket change [397ab81ab3] (rid 112397) by dkf on 2011-08-25 15:17:01:

    1. icomment:
      That would most certainly count as an unwanted side effect. It seems to result from the changes to work with NRE (specifically, going from using Tcl_EvalObjv to Tcl_NREvalObj).
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  16. Ticket change [7586cd18c2] (rid 105407) by nijtmans on 2011-08-25 15:33:11:

    1. icomment:
      >The degraded benchmarks test the speed of
      >string reverse [string range $long 1 $length]
      
      Thanks! That sounds logical.
      
      Of course we could ad a special case for this
      in TclStringObjReverse, but I guess that
      "string range" could also be speeded up by
      not generating the Unicode representation.
      
      Working on this........
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  17. Ticket change [b782fb61e0] (rid 125611) by ferrieux on 2011-08-25 17:50:13:

    1. icomment:
      Re the extra ref in ensembles. It seems to me that it is a necessary consequence of the absence of "frame surgery" when rewriting the command-and-args. See label "runResultingSubcommand" in NsEnsembleImplementationCmdNR: here we prepare a new objv[], we are not modifying in-place the framePtr->objv, hence the incrrefcount. Not sure it is NRE's fault :)
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  18. Ticket change [8d974b46ac] (rid 127957) by msofer on 2011-08-25 18:03:03:

    1. icomment:
      If we find a way to fixt that and do "frame surgery", we should make sure to also use elsewhere - the [interp alias] implementation is a definite candidate
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  19. Ticket change [ddc6a1eaeb] (rid 114732) by nijtmans on 2011-08-25 19:01:32:

    1. icomment:
      Special case committed to trunk for Pure Unicode-situation. This should
      be faster in all situations.
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  20. Ticket change [b0a3983d0c] (rid 98019) by dkf on 2011-08-25 19:28:10:

    1. icomment:
      We should probably follow up on the NRE stuff as a separate issue.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  21. Ticket change [6606725e41] (rid 102644) by dkf on 2011-08-25 19:28:29:

    1. assignee changed to: "nijtmans"
  22. Ticket change [6838bad6fa] (rid 103023) by dgp on 2011-08-25 19:48:17:

    1. assignee changed to: "dkf"
    2. icomment:
      See 3397978 for continued examination
      of the value sharing issue.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. username: "dgp"
  23. Ticket change [188710f64d] (rid 122675) by dgp on 2011-08-25 19:50:41:

    1. icomment:
      nijtmans, if you do pursue futher shimmering
      reform in tclStringObj.c, please make your
      commits to a feature branch first.  Some of the
      most striking performance improvements in
      Tcl 8.6 have come from improved use of the 
      "pure unicode" type, and I want the chance to
      confirm those improvements are not lost in
      continued reform.  Thanks!
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  24. Ticket change [9eae69815b] (rid 96520) by dgp on 2011-08-25 23:28:46:

    1. icomment:
      Thank you for the update to the trunk.
      
      I have produced my own update 
      
      http://core.tcl.tk/tcl/info/61d345ff2f
      
      which is the new tip of the revert-3396731 branch.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  25. Ticket change [9d7bf4026d] (rid 96314) by dgp on 2011-08-25 23:36:30:

    1. icomment:
      
      I've also extended the "reverse core" benchmarks
      in tclbench so that it includes testing the reversal of
      strings of length 4000 and 40000 chars to get a more
      complete picture of scalability.  Then looking at several
      variants I get this:
      
      Column 1 = "trunk before we started attempting these patches"
      Column 2 = "revert branch tip (my patch)"
      Column 3 = "current trunk (your patch)"
      Column 4 = "8.5 branch"
      
      001 STR reverse core, 10 c         3.49     3.49     3.69     2.78
      002 STR reverse core, 10 uc        3.67     3.69     3.37     2.92
      003 STR reverse core, 100 c        3.67     3.67     5.31     2.89
      004 STR reverse core, 100 uc       3.78     3.85     3.54     3.10
      005 STR reverse core, 400 c        4.03     4.21    10.78     3.28
      006 STR reverse core, 400 uc       4.17     4.38     4.03     3.67
      007 STR reverse core, 4000 c       8.43    10.69    75.14     7.66
      008 STR reverse core, 4000 uc      8.54    10.97    10.59    10.25
      009 STR reverse core, 40000 c     58.18    76.50   724.64    54.33
      010 STR reverse core, 40000 uc    55.26    76.70    76.08    75.76
      
      
      At least for the code paths covered by the
      benchmarks, the current trunk is clearly
      worst and has some severe scaling problem.
      
      My patch is better than that, but still not as good
      as the trunk was before any of us started 
      doing anything.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  26. Ticket change [c52984736f] (rid 111949) by dgp on 2011-08-27 11:00:33:

    1. icomment:
      
      Found the flaw in my loop hotspots that
      was slowing them down compared to
      the former trunk.  Update tclbench results:
      
      001 STR reverse core, 10 c         3.73     3.55     3.50     2.81
      002 STR reverse core, 10 uc        3.36     3.73     3.68     2.93
      003 STR reverse core, 100 c        5.35     3.71     3.64     2.91
      004 STR reverse core, 100 uc       3.52     3.86     3.77     3.12
      005 STR reverse core, 400 c       10.85     4.05     4.01     3.27
      006 STR reverse core, 400 uc       4.08     4.24     4.17     3.67
      007 STR reverse core, 4000 c      75.62     8.57     8.39     7.66
      008 STR reverse core, 4000 uc     10.68     8.67     8.59    10.28
      009 STR reverse core, 40000 c    730.58    61.96    54.48    54.01
      010 STR reverse core, 40000 uc    77.10    55.44    55.57    76.43
      
      This time:
      Column 1 = current trunk
      Column 2 = former trunk
      Column 3 = my patch
      Column 4 = 8.5 branch
      
      I'll be merging my patch into the trunk.
      It takes the core idea of the original
      feature request and implements it in
      ways that don't lose performance as
      measured by tclbench.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  27. Ticket change [7b2f0de628] (rid 90479) by dgp on 2011-08-27 11:35:07:

    1. assignee changed to: "dgp"
    2. icomment:
      
      Alternate patch merged to trunk.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. username: "dgp"
  28. Ticket change [08f331996f] (rid 89644) by nijtmans on 2011-08-29 14:27:46:

    1. icomment:
      A few minor remarks...:
      - ReverseUniChars contains the line
            from += count - 1
        but the "from" variable is not used any
        more after that.
      - ReverseBytes() should be static ;-)
      - ReverseUniChars is only called once, so it
        can be inlined. That allows us to separate the
        inline case from tthe non-line case better , so
        it saves an additional if().
      - src = from + count -1: the substraction of 1
        can be saved by changing the loop a little bit.
      - The Tcl_Unichar ch declaration can be put
        outside the loop.
      
      Committed to trunk. Nice work, Don, and
      thank you very much for the evaluation
      and improvements!!!!
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"