On Mon, 2003-12-01 at 02:11, Glen Mazza wrote: > --- John Austin <[EMAIL PROTECTED]> wrote: > > I mentioned yesterday that I thought I had read a > > comment > > by Bruce Eckel suggesting that String.intern() might > > be > > avoided. > > > > I could not find the reference in either the 2nd or > > 3rd editions > > of "Thinking In Java". > > > > No need-the "gotcha" site you gave earlier did give > some specific drawbacks under string compares: > > http://mindprod.com/jgloss/gotchas.html#COMPARISON > > BTW, The third drawback listed in the link above gave > "weak references" as an alternative implmentation--I'm > unsure what that construct is about--is this the > vtable you were speaking of in an earlier message? > > Also, another question for my comprehension here--the > "canonical mappings" you have been referring to in > this thread--is this the same thing as the property > enumerations that alt-design uses? I'm unsure of the > difference between the two.
I started using the term here after re-reading parts of Eckel's Thinking in Java. I think the CM I refer to and the alt-design implementation are almost to the same thing. >From the on-line version of TIJ(3rd ed) the following excerpt: TIJ313.htm: Weak references are for implementing canonicalizing mappings where instances of objects can be simultaneously used in multiple places in a program, to save storage - that do not prevent their keys (or values) from being reclaimed. Don't be mislead to the red herring of 'weak references'. I am arguing for the "cache of unique objects" not for this GC technique. After I started using a large .FO file to provide statistics, I realized that we can use the same technique for larger non-string objects. To this end, I have some more statistics. In the sample FO file (DocBook: The Definitive Guide), there are 285,223 tags but there are only 18,419 unique property lists. (There may be fewer, my perl stats program treats different orderings of the same attributes as different lists) The program prints out property lists which occur more than 100 times. I prefix each list with tag names to distinguish empty lists by tag type. That increases the number of lists by only 15 or so. Number of Elements by tree level: level=1 count=1 level=2 count=473 level=3 count=5242 level=4 count=5480 level=5 count=7129 level=6 count=26231 level=7 count=22475 level=8 count=36447 level=9 count=62288 level=10 count=38536 level=11 count=30486 level=12 count=23641 level=13 count=23190 level=14 count=2023 level=15 count=771 level=16 count=701 level=17 count=109 Element frequencies: a 24 fo:basic-link 5225 fo:block 112142 fo:conditional-page-master-reference 48 fo:external-graphic 1097 fo:flow 472 fo:footnote 22 fo:footnote-body 22 fo:inline 62792 fo:layout-master-set 1 fo:leader 1764 fo:list-block 279 fo:list-item 1004 fo:list-item-body 1004 fo:list-item-label 1004 fo:marker 5335 fo:page-number 1872 fo:page-number-citation 3224 fo:page-sequence 472 fo:page-sequence-master 12 fo:region-after 38 fo:region-before 38 fo:region-body 38 fo:repeatable-page-master-alternatives 12 fo:root 1 fo:simple-page-master 38 fo:static-content 4720 fo:table 6497 fo:table-body 6497 fo:table-cell 33174 fo:table-column 19225 fo:table-footer 1 fo:table-header 29 fo:table-row 15301 fo:wrapper 1799 Property List frequencies: 395 fo:basic-link internal-destination=common.attributes, 66878 fo:block 1292 fo:block end-indent=24pt,text-align-last=justify,last-line-end-indent=-24pt, 2119 fo:block font-family=monospace,space-after.optimum=1em,white-space-collapse=false,text-align=start,space-before.maximum=1.2em,space-before.optimum=1em,wrap-option=no-wrap,space-before.minimum=0.8em,space-after.maximum=1.2em,linefeed-treatment=preserve,space-after.minimum=0.8em, 5082 fo:block font-family=sans-serif,Symbol,ZapfDingbats,keep-together=always, 236 fo:block font-family=sans-serif,Symbol,ZapfDingbats,margin-left=-4pc,keep-together=always, 439 fo:block font-family=sans-serif,space-after.optimum=0.5em,hyphenate=false,font-weight=bold,font-size=18pt,space-after.maximum=0.6em,space-after.minimum=0.4em,keep-with-next.within-column=always,space-after=1em, 5321 fo:block font-family=sans-serif,space-before.maximum=1.2em,font-weight=bold,space-before.optimum=1.0em,space-before.minimum=0.8em,keep-with-next.within-column=always, 3768 fo:block font-family=serif,Symbol,ZapfDingbats,margin-left=-4pc, 3533 fo:block font-size=17.28pt, 1722 fo:block font-size=20.735999999999997pt, 104 fo:block font-weight=bold, 5332 fo:block keep-with-next.within-column=always, 439 fo:block space-after=1em, 6037 fo:block space-before.maximum=1.2em,space-before.optimum=1em,space-before.minimum=0.8em, 2558 fo:block span=none, 191 fo:block start-indent=1pc, 476 fo:block text-align=center, 472 fo:flow flow-name=xsl-region-body, 2114 fo:inline 50373 fo:inline font-family=monospace, 175 fo:inline font-family=monospace,font-style=italic, 448 fo:inline font-family=serif, 1055 fo:inline font-style=italic, 5817 fo:inline font-weight=bold, 115 fo:inline hyphenate=false, 1292 fo:inline keep-together.within-line=always, 1292 fo:inline keep-with-next.within-line=always, 462 fo:leader color=black,leader-pattern=rule,leader-length=1in, 1292 fo:leader keep-with-next.within-line=always,leader-pattern-width=3pt,leader-pattern=dots,leader-alignment=reference-area, 1004 fo:list-item-body start-indent=body-start(), 313 fo:list-item-label end-indent=label-end(), 671 fo:list-item-label end-indent=label-end(),text-align=start, 5335 fo:marker marker-class-name=section.head.marker, 1872 fo:page-number 446 fo:page-sequence hyphenation-push-character-count=2,hyphenation-character=-,xmlns:axf=http://www.antennahouse.com/names/XSL/Extensions,language=en,hyphenate=true,hyphenation-remain-character-count=2,master-reference=body,format=1, 472 fo:static-content flow-name=blank-body, 472 fo:static-content flow-name=xsl-footnote-separator, 472 fo:static-content flow-name=xsl-region-after-blank, 472 fo:static-content flow-name=xsl-region-after-even, 472 fo:static-content flow-name=xsl-region-after-first, 472 fo:static-content flow-name=xsl-region-after-odd, 472 fo:static-content flow-name=xsl-region-before-blank, 472 fo:static-content flow-name=xsl-region-before-even, 472 fo:static-content flow-name=xsl-region-before-first, 472 fo:static-content flow-name=xsl-region-before-odd, 144 fo:table space-before.maximum=1.2em,space-before.optimum=1em,space-before.minimum=0.8em, 1887 fo:table width=100%,table-layout=fixed,border-bottom-width=0.5pt,border-bottom-style=solid,border-bottom-color=black, 1887 fo:table width=100%,table-layout=fixed,border-top-color=black,border-top-style=solid,border-top-width=0.5pt, 6497 fo:table-body 756 fo:table-cell 1848 fo:table-cell display-align=after,text-align=center,relative-align=baseline, 1848 fo:table-cell display-align=after,text-align=left,relative-align=baseline, 1848 fo:table-cell display-align=after,text-align=right,relative-align=baseline, 1848 fo:table-cell display-align=before,text-align=center,relative-align=baseline, 1848 fo:table-cell display-align=before,text-align=left,relative-align=baseline, 1848 fo:table-cell display-align=before,text-align=right,relative-align=baseline, 2583 fo:table-cell padding-bottom=2pt,padding-top=2pt,border-bottom-width=0.5pt,border-bottom-style=solid,border-right-color=black,padding-right=2pt,border-right-width=0.5pt,border-right-style=solid,padding-left=2pt,border-bottom-color=black, 1026 fo:table-cell padding-bottom=2pt,padding-top=2pt,border-bottom-width=0.5pt,border-bottom-style=solid,border-right-color=black,padding-right=2pt,text-align=center,border-right-width=0.5pt,border-right-style=solid,padding-left=2pt,border-bottom-color=black, 956 fo:table-cell padding-bottom=2pt,padding-top=2pt,border-bottom-width=0.5pt,border-bottom-style=solid,display-align=after,border-right-color=black,padding-right=2pt,text-align=center,border-right-width=0.5pt,border-right-style=solid,padding-left=2pt,border-bottom-color=black, 1578 fo:table-cell padding-bottom=2pt,padding-top=2pt,border-bottom-width=0.5pt,border-bottom-style=solid,display-align=before,border-right-color=black,padding-right=2pt,text-align=left,border-right-width=0.5pt,border-right-style=solid,padding-left=2pt,border-bottom-color=black, 789 fo:table-cell padding-bottom=2pt,padding-top=2pt,border-bottom-width=0.5pt,border-bottom-style=solid,display-align=before,padding-right=2pt,text-align=left,padding-left=2pt,border-bottom-color=black, 118 fo:table-cell padding-bottom=2pt,padding-top=2pt,border-bottom-width=0.5pt,border-bottom-style=solid,padding-right=2pt,number-columns-spanned=2,padding-left=2pt,border-bottom-color=black, 2095 fo:table-cell padding-bottom=2pt,padding-top=2pt,border-bottom-width=0.5pt,border-bottom-style=solid,padding-right=2pt,padding-left=2pt,border-bottom-color=black, 831 fo:table-cell padding-bottom=2pt,padding-top=2pt,border-bottom-width=0.5pt,border-bottom-style=solid,padding-right=2pt,text-align=left,number-columns-spanned=3,padding-left=2pt,border-bottom-color=black, 142 fo:table-cell padding-bottom=2pt,padding-top=2pt,display-align=before,border-right-color=black,padding-right=2pt,text-align=left,border-right-width=0.5pt,border-right-style=solid,padding-left=2pt, 278 fo:table-cell padding-bottom=2pt,padding-top=2pt,padding-right=2pt,number-columns-spanned=2,padding-left=2pt, 5588 fo:table-cell padding-bottom=2pt,padding-top=2pt,padding-right=2pt,padding-left=2pt, 4904 fo:table-cell padding-bottom=2pt,padding-top=2pt,padding-right=2pt,text-align=left,number-columns-spanned=3,padding-left=2pt, 2552 fo:table-column column-number=1, 3918 fo:table-column column-number=1,column-width=proportional-column-width(1), 2553 fo:table-column column-number=2, 3777 fo:table-column column-number=2,column-width=proportional-column-width(1), 2549 fo:table-column column-number=3, 3776 fo:table-column column-number=3,column-width=proportional-column-width(1), 11527 fo:table-row 3774 fo:table-row height=14pt, 18419 Property Lists Properties: 526648 Tags: 285223 num_keys: 117 num_vals: 13520 -- John Austin <[EMAIL PROTECTED]>