• No results found

Results In a number of tests, DIGITAL C++ version 6.0 showed improved performance over version 5 6.

In document dtj v10 01 1998 pdf (Page 32-35)

We tested a variety of user code samples that use tem­

plates to varying degrees and found that build times tor

version 6.0 decreased substantially compared to tl1e

version

5 . 6

compiler. Examples of two typical C++

applications used in our tests are the publicly available

EON ray-tracing benchmark and a subset of tests from

our Standard Template Library

(STL)

test suite. For

30

the EON benchnurk, the build time for version 6.0 was reduced to 28 percent of the build time tor version 5 .6 . For the STL tests, t h e build ti me tor version 6 . 0 was reduced to 1 9 percent of the build time for version 5 . 6 . The number o f files in the repository also decreased signiticmtly because version 6.0 generates only i nstan ­ tiation object fi les i nstead o f the instan tiation source, command, dependency, and object files of\-crsion 5 .6 . For EON, the version 6 . 0 repository contained 8 8 files compared to 260 files in version 5 .6.

Using the ti me-stamp option, build time tor the

EON benchmark was reduced by onl y 5 percent com ­ pared to t h e dcfJult instantiation strJtegy. The real benefit of the time-stamp option comes with appl ica­ tions that usc the same template i nstantiations in many compilation units. For example, in one user's test case, build times dropped from roughly 18 hours with the default instantiation to 3 hours when using the time­ stamp option.

In tl1e next section, we conclude our paper with a dis­ cussion of furtl1er work that can improve the perfor­ mance and usability of automatic template instantiation. Future Research

We continue to investigate approaches and techniq ues to improve tl1e usJbility and performance of the auto­ matic template instantiJtion facility. Optimal usJbility and performance would seem to require a development environment completely intq!;rJted for C++. This envi ­ ronment would keep track of all entity definitions Jnd usage <md would be able to li mit aiJ inst:.mtiation gener­ ation to the m i nimum needed . This approach would req uire a great deal of development work and might be difficult to integrate with existing customer develop­ ment methodologies. Therefore, we focus on more modest techniques tlut approxi nute tl1e optimal case. vVe are exploring WJ)'S to improve both performance and usability in the mJnJgement of dependency infor­ mation . We continue to look at approaches for using dependencies that can be reliable, automatic , and fast. We also continue to investigate ways to gJther and check fine-grained dependency int(xmation for the instanti­ ation object fi les, though performance is J concern.

One approximJtion to the tine-grain dependency information that we are investigating is a larger grain dependency scheme. This techniq ue creates a time stamp ti·om the latest creation time of any sou rce tile included during compilation of a given module. Any i nstantiation object fi le i n the repository whose modj­ fication ti me is later than th is time stamp would not be regenerated. This approach is more automatic and can potentially yield better performance than our cu rrent time-stamp option, but it would not be sensitive to changes on the command line or changes to the struc-

Disiral Tcchni-::11 Journal Vol. 10 No. l J 998

ture of the tiles used to generate the i nstJntiation. For example, if the user specified Jn i nc l u de d irectory of old_include on the i nitial compibtion and later specified J.n i nclude directory of new_incl ude, this approach would not recognize that differen t fi les were being included.

Another approach to improving application build performance is to support a build facility that can make use of template inf(m11Jtion in determining dependency. Currently, each user-specified object file is dependent on :�II the i ncluded files necessary to create instantiation object fi les f(>r templ ate req uests. When a change is made to a tempbte definition, all the sources that reference the template need to be recom­ piled. A build facility designed to be sensitive to tem­ plate i nstJntiation could detect that a change in the template definition was limited to the i nstantiation object file. It could then i nstruct the compi ler to sup­ press the regeneration of object fi les tor sou rce files that are only being recompi led due to the ci1Jnge in the template instantiation . Such a f.1cility could also suppress the recompiiJtion of any source file thJt would only reproduce the changes to i nstantiations that were already regenerated .

Because we recognize that link-time instanti:�tion can pertonn better i n some cases than the compile-time approach, we Jre investigating the l ink-time inst:�ntia­ tion model as a user option.

Finally, we continue to look at ways to reduce the cost of generating each instantiation . For example, by default the compi ler compresses the generated object files. Although most instantiation object files are smal l , many oftl1em are potential ly generated in a si ngle com ­ piJation. As a result, the time to compress all the i nstan­ tiation object fi les can be signific.1nt. Improvements such as not compressing small object files Jnd/or improving the algorithm of the object fi le compression implementation i tself could yield significant perfor­ mance improvement. I n add ition to improvements tlut would reduce the overhead of generating instanti­ ations, we are also researching wJys to reduce the num­ ber of instantiation object files. For ex:�mple, we might combine all the virtual functions of a ciJss into a single instantiation object file in the repository.

Summary

As vvith most engineering problems, no single Jpproach to tl1e automatic instantiation of templates is optimal for all potential uses of templates. Rased on our experience witl1 providing template support in DIG ITAL C++, we chose to implement a compile-time automatic template instantiation scheme for version 6.0 tl1at generates instantiation object files into a repository. This choice allows users to better control when templ:�te instantia-

tion occurs. In addition, it provides a substantial improvement in performance of template instantiation over version

5.6

and reduces the restrictions on the location of template declarations and definitions. We continue to investigate the template-instantiation imple­ mentation to further improve compile- and link-time performance and ease of use.

Acknowledgment

The authors wish to acknowledge Bevin B rett, who contributed substantially to the design and implemen­ tation of the needed wal k and instantiation object file generation for DIGITAL C++ version

6.0,

and Hemant Rotithor, who provided the performance measurements for D I GITAL C++ version

6.0

versus version

5 .6.

The authors also wish to acknowledge Charlie Mitchel l, Coleen PhiUimore, Rich Phillips, and Harold Seigel for their contributions to the design and implementation of the DIGITAL C++ automatic tem­ plate instantiation.

References

l . ISO/IEC Standard 1 48 8 2 , Programming Language C++, 1 998 .

2. B . Stroustrup, Tbe C++ Programming Language,

Third Edition ( Reading, Mass . : Addison-Wesley,

1 997).

3 . Microsoft Visual C++ 5.0, On-line Help, "Templates, C++."

4. 1\tl icrosoft Corporation, "Microsoft Portable Exe­ cutable and Common Object File Format Speciftca­ tion," Revision 5 .0, Section 5 . 5 .6, Microsojt

Deueloper�· Network ( October 1997).

5 . G. McCluskey, "An Environment tor Template Instan­ tiation," Tbe C++ Report, voL 4, no. 2 ( 1 992 ). 6. G. McCluskey and R. Murray, "Template I nstantiation

for C++," Sigplan Notices, vaL 27, no . 1 2 ( 1 99 2 ) : 47-56.

7 . Edison Design Group, "Template I nstantiation i n the EDG C++ Front End," Note to the Al'\JSI C++ Com­ mittee, X3J l 6/9 5 - 0 l 6 3 , WG2 1 /N0763.

8 . M . Ellis and B. Stwustrup, 77.?e A nnotated C++ Refer­ ence /VIanual ( Reading, Mass . : Add ison-Wesley, 1 990 ) .

9 . B . Stroustrup, Tbe Design a.nd Evolution of C++ ( Read ing, Mass . : Addison-Wesley, 1 994): 366. 1 0 . B . Stroustrup, The C++ Programming Language,

Third Edition ( Reading, Mass.: Addison-Wesley, 1 997): 203-205 .

Biographies

Avrwn E. Itzkowitz

Avrum Itzkowitz was a contractor/consultant at DIGITAL from September 1995 through December 1 997. During that time, he worked as part of the DIGITAL C++ develop­ ment team, designing and implementing much of the sup­ port for the automatic template instantiation facility i n DIGITAL C++ version 6 . 0 . Avrum also designed and implemented template instantiation tests. He is currently a senior software architect engineer at GTE lnternetworking. He holds a B .S . ( 1 9 7 2 ) in electrical engineering from Northwestern University and M.S. ( 1 976) and Ph.D.

( 1 979) degrees in computer science from the University of lll.inois. Avrum is a member of the ACM, the IEEE­ Computer Society, and SIGPLAN .

Lois D. Foltan

Lois Foltan is a principal software engineer at Compaq. Her areas of expertise include support for C++ automatic template i nstantiation and the DIG ITAL C++ object model . She was a member of the DEC C/C++ compiler team for eight years. During that rime, she contributed

to the first GEM-based DEC C and DEC C++ compilers. Recently, she joined the Digital Java ream. Lois received a B .S. in computer science from the University ofVermont in 1 988.

32

Measurement and

In document dtj v10 01 1998 pdf (Page 32-35)