-
Lubomir Bourdev and Jaakko Järvi.
Efficient Run-Time Dispatching in Generic Programming with Minimal Code Bloat.
Science of Computer Programming,
2008.
Note: To appear.
Keyword(s): Generic Programming,
C++.
Abstract: |
Generic programming with C++ templates results in efficient but inflexible code: efficient, because the exact types of inputs to generic functions are known at compile time; inflexible because they must be known at compile time. We show how to achieve run-time polymorphism without compromising performance by instantiating the generic algorithm with a comprehensive set of possible parameter types, and choosing the appropriate instantiation at run time. Applying thisapproach naively can result in excessive template bloat: a large number of template instantiations, many identical at the assembly level. We show practical examples of this approach quickly approaching the limits of the compiler. Consequently, we combine this method of run-time polymorphism for generic programming with a strategy for reducing the number of necessary template instantiations. We report on using our appro ach in GIL, Adobe's open source Generic Image Library. We observed notable reduction, up to 70\% at times, in executable sizes of our test programs. This was the case even with compilers that perform aggressive template hoisting at the compiler level, due to significantly smaller dispatching code. The framework draws from both the generic and generative programming paradigms, using static metaprogramming to fine tune the compilation of a generic library. Our te st bed, GIL, is deployed in a real world industrial setting, where code size is often an important factor. |
@article{bourdev:08:scp,
author = {Lubomir Bourdev and Jaakko J\"arvi},
title = {Efficient Run-Time Dispatching in Generic Programming with Minimal Code Bloat},
journal = {Science of Computer Programming},
year = 2008,
doi = {10.1016/j.scico.2008.06.003},
note = {To appear},
keyword = GP,
keyword = CPP,
abstract = {Generic programming with C++ templates results in efficient but inflexible code: efficient, because the exact types of inputs to generic functions are known at compile time; inflexible because they must be known at compile time. We show how to achieve run-time polymorphism without compromising performance by instantiating the generic algorithm with a comprehensive set of possible parameter types, and choosing the appropriate instantiation at run time. Applying thisapproach naively can result in excessive template bloat: a large number of template instantiations, many identical at the assembly level. We show practical examples of this approach quickly approaching the limits of the compiler. Consequently, we combine this method of run-time polymorphism for generic programming with a strategy for reducing the number of necessary template instantiations. We report on using our appro ach in GIL, Adobe's open source Generic Image Library. We observed notable reduction, up to 70\% at times, in executable sizes of our test programs. This was the case even with compilers that perform aggressive template hoisting at the compiler level, due to significantly smaller dispatching code. The framework draws from both the generic and generative programming paradigms, using static metaprogramming to fine tune the compilation of a generic library. Our te st bed, GIL, is deployed in a real world industrial setting, where code size is often an important factor.}
}
-
Douglas Gregor and Jaakko Järvi.
Variadic templates for C++0x.
Journal of Object Technology,
7(2):31-51,
February 2008.
Note: Special Issue OOPS Track at SAC 2007.
Keyword(s): C++.
@Article{gregor08:jot-variadics,
author = {Douglas Gregor and Jaakko J{\"a}rvi},
title = {Variadic templates for {C++0x}},
journal = {Journal of Object Technology},
volume = 7,
number = 2,
month = feb,
year = 2008,
pages = {31--51},
url = {http://www.jot.fm/issues/issue_2008_02/article2/},
note = {Special Issue {OOPS} Track at {SAC} 2007},
keyword = CPP,
}
-
Jaakko Järvi and John Freeman.
Lambda functions for C++0x.
In SAC '08: Proceedings of the 2008 ACM symposium on Applied computing,
New York, NY, USA,
pages 178-183,
2008.
ACM.
Note: Best paper award (Software theme).
Keyword(s): C++.
@inproceedings{jarvi08:lambda_sac,
author = {Jaakko J\"{a}rvi and John Freeman},
title = {Lambda functions for {C++0x}},
booktitle = {SAC '08: Proceedings of the 2008 ACM symposium on Applied computing},
year = {2008},
isbn = {978-1-59593-753-7},
pages = {178--183},
location = {Fortaleza, Ceara, Brazil},
doi = {10.1145/1363686.1363735},
publisher = {ACM},
address = {New York, NY, USA},
note = {Best paper award (Software theme)},
keyword = CPP,
}
-
Jaakko Järvi,
Mat Marcus,
Sean Parent,
John Freeman,
and Jacob N. Smith.
Property models: from incidental algorithms to reusable components.
In GPCE '08: Proceedings of the 7th international conference on Generative programming and component engineering,
New York, NY, USA,
pages 89-98,
2008.
ACM.
Abstract: |
A user interface, such as a dialog, assists a user in synthesising a set of values, typically parameters for a command object. Code for ``command parameter synthesis'' is generally considered application-specific and non-reusable, consisting of validation logic in event handlers and code that controls how values of user interface elements change in response to a user's actions, etc. These software artifacts are \emph{incidental}---they are not explicitly designed and their implementation emerges from a composition of locally defined behaviors. This article presents \emph{property models} to capture explicitly the algorithms, validation, and interaction rules, arising from command parameter synthesis. A user interface's behavior can be derived from a declarative property model specification, with the assistance of a component akin to a constraint solver. This allows multiple interfaces, both human and programmatic, to reuse a single model along with associated validation logic and widget activation logic. The proposed technology is deployed in large commercial software application suites. Where we have applied property models, we have measured significant reductions in source-code size with equivalent or increased functionality; additional levels of reuse are apparent, both within single applications, and across product lines; and applications are able to provide more uniform access to functionality. There is potential for wide adoption: by our measurements command parameter synthesis comprises roughly one third of the code and notably more of the defects in desktop applications. |
@inproceedings{jarvi:08:gpce,
author = {Jaakko J\"{a}rvi and Mat Marcus and Sean Parent and John Freeman and Jacob N. Smith},
title = {Property models: from incidental algorithms to reusable components},
booktitle = {GPCE '08: Proceedings of the 7th international conference on Generative programming and component engineering},
year = {2008},
isbn = {978-1-60558-267-2},
pages = {89--98},
location = {Nashville, TN, USA},
doi = {10.1145/1449913.1449927},
publisher = {ACM},
address = {New York, NY, USA},
pdf = "http://parasol.cs.tamu.edu/~jarvi/papers/gpce08.pdf",
abstract = {A user interface, such as a dialog, assists a user in synthesising a set of values, typically parameters for a command object. Code for ``command parameter synthesis'' is generally considered application-specific and non-reusable, consisting of validation logic in event handlers and code that controls how values of user interface elements change in response to a user's actions, etc. These software artifacts are \emph{incidental}---they are not explicitly designed and their implementation emerges from a composition of locally defined behaviors. This article presents \emph{property models} to capture explicitly the algorithms, validation, and interaction rules, arising from command parameter synthesis. A user interface's behavior can be derived from a declarative property model specification, with the assistance of a component akin to a constraint solver. This allows multiple interfaces, both human and programmatic, to reuse a single model along with associated validation logic and widget activation logic. The proposed technology is deployed in large commercial software application suites. Where we have applied property models, we have measured significant reductions in source-code size with equivalent or increased functionality; additional levels of reuse are apparent, both within single applications, and across product lines; and applications are able to provide more uniform access to functionality. There is potential for wide adoption: by our measurements command parameter synthesis comprises roughly one third of the code and notably more of the defects in desktop applications.}
}
-
Xiaolong Tang and Jaakko Järvi.
Realizing Domain-specific Compiler Optimizations via Generic Programming.
In 2nd International Workshop on Domain-Specific Program Development (DSPD),
October 2008.
Note: Position paper.
Keyword(s): High-level Optimization.
@inproceedings{tang:08:dspd,
title = {Realizing Domain-specific Compiler Optimizations via Generic Programming},
booktitle = {2nd International Workshop on Domain-Specific Program Development (DSPD)},
author = {Xiaolong Tang and Jaakko J{\"a}rvi},
location = {Nashville, Tennessee},
month = oct,
year = 2008,
keyword = OPT,
note = {Position paper},
url = {http://www.labri.fr/perso/reveille/DSPD/2008/papers/8.pdf},
}
-
Jaakko Järvi and Peter Dimov.
Constness of Lambda Functions.
Technical report N2651=08-0161,
ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming Language C++,
May 2008.
Keyword(s): C++ Standardization.
@techreport{jarvi:08:lambda-constness,
author = {Jaakko J\"arvi and Peter Dimov},
title = {Constness of Lambda Functions},
institution = "ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming Language {C++}",
number = "N2651=08-0161",
year = 2008,
month = may,
pdf = "http://parasol.cs.tamu.edu/~jarvi/papers/n2651.pdf",
keyword = ISOCPP,
}
-
Jaakko Järvi,
Peter Dimov,
and John Freeman.
Constness of Lambda Functions (Revision 1).
Technical report N2658=08-0168,
ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming Language C++,
May 2008.
Keyword(s): C++ Standardization.
@techreport{jarvi:08:lambda-constness_rev1,
author = {Jaakko J\"arvi and Peter Dimov and John Freeman},
title = {Constness of Lambda Functions (Revision 1)},
institution = "ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming Language {C++}",
number = "N2658=08-0168",
year = 2008,
month = may,
pdf = "http://parasol.cs.tamu.edu/~jarvi/papers/n2658.pdf",
keyword = ISOCPP,
}
-
Jaakko Järvi,
John Freeman,
and Lawrence Crowl.
Lambda Expressions and Closures: Wording for Monomorphic Lambdas (Revision 3).
Technical report N2529=08-0039,
ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming Language C++,
February 2008.
Keyword(s): C++ Standardization.
@techreport{jarvi:08:c++_lambda_wording_3,
author = {Jaakko J\"arvi and John Freeman and Lawrence Crowl},
title = {Lambda Expressions and Closures: Wording for Monomorphic Lambdas (Revision 3)},
institution = "ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming Language {C++}",
number = "N2529=08-0039",
year = 2008,
month = feb,
pdf = "http://parasol.cs.tamu.edu/~jarvi/papers/n2529.pdf",
keyword = ISOCPP,
}
-
Jaakko Järvi,
John Freeman,
and Lawrence Crowl.
Lambda Expressions and Closures: Wording for Monomorphic Lambdas (Revision 4).
Technical report N2550=08-0060,
ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming Language C++,
February 2008.
Keyword(s): C++ Standardization.
@techreport{jarvi:08:c++_lambda_wording_4,
author = {Jaakko J\"arvi and John Freeman and Lawrence Crowl},
title = {Lambda Expressions and Closures: Wording for Monomorphic Lambdas (Revision 4)},
institution = "ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming Language {C++}",
number = "N2550=08-0060",
year = 2008,
month = feb,
pdf = "http://parasol.cs.tamu.edu/~jarvi/papers/n2550.pdf",
keyword = ISOCPP,
}