Skip to main content

Comparison of Runtime Performance Optimization Using Template-Metaprogramming

  • Conference paper
  • First Online:
Smart and Innovative Trends in Next Generation Computing Technologies (NGCT 2017)

Abstract

Programs capable of generating code are known as meta-programs and the technique of writing these programs is known as meta programming Meta programming is supported by various programming languages such as C#, where reflection is used; Ruby allows defining classes and methods at runtime using meta-programming; the first language to introduce the concept of meta-programming was LISP. The meta-programs written using these languages are generally parsers, theorem proofs and interpreters. In this paper, we’ll be demonstrating the use of meta-programming in C++ through template meta-programming (TMP). We pick up common mathematical operations, creating a run time code of them along with a compile time based equivalent code done through TMP. The two set of codes are then benchmarked on the basis of their execution time and a bar-graph is generated to compare the TMP and non-TMP programs.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 99.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 129.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Abrahams, D., Gurtovoy, A.: C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond, Portable Documents. Pearson Education, London (2004)

    Google Scholar 

  2. Czarnecki, K., Eisenecker, U.W.: Generative Programming: Methods, Tools and Applications. Addison-Wesley, Boston (2000)

    Google Scholar 

  3. Porkoláb, Z., Mihalicza, J., Sipos, Á.: Debugging C++ template metaprograms. In: Proceedings of the 5th International Conference on Generative Programming and Component Engineering (2006)

    Google Scholar 

  4. Teodorescu, L.R., Dumitrel, V., Potolea, R.: Moving computations from run-time to compile-time: hyper-metaprogramming in practice. In: Proceedings of the 11th ACM Conference on Computing Frontiers. ACM (2014)

    Google Scholar 

  5. Vandevoorde, D., Josuttis, N.M.: C++ Templates: The Complete Guide. Addison-Wesley, Boston (2003)

    Google Scholar 

  6. Sorting Algorithms Animation showing efficiency of different algorithms on different types of data sets (n.d.). https://www.toptal.com/developers/sorting-algorithms

  7. Isensee, P.: Fast math using template metaprogramming. In: Game Programming Gems, pp. 20–34. Charles River Media Inc. (2003)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Piyush Mishra .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer Nature Singapore Pte Ltd.

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Patel, V., Mishra, P., Patni, J.C., Mittal, P. (2018). Comparison of Runtime Performance Optimization Using Template-Metaprogramming. In: Bhattacharyya, P., Sastry, H., Marriboyina, V., Sharma, R. (eds) Smart and Innovative Trends in Next Generation Computing Technologies. NGCT 2017. Communications in Computer and Information Science, vol 827. Springer, Singapore. https://doi.org/10.1007/978-981-10-8657-1_11

Download citation

  • DOI: https://doi.org/10.1007/978-981-10-8657-1_11

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-10-8656-4

  • Online ISBN: 978-981-10-8657-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics