Lightweight Abstraction for Mathematical Computation in Java

  • Pavel Bourdykine
  • Stephen M. Watt
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7442)


Many object-oriented programming languages provide type safety by allowing programmers to introduce distinct object types. In the case of Java, having objects as the sole abstraction mechanism also introduces a considerable or even prohibitive cost, especially when dealing with small objects over primitive types. Consequently, Java library implementations frequently avoid abstraction and are not type safe in practice. Many applications, including computer algebra, use values logically belonging to many different non-interchangable types. Languages such as Java are then either unsafe or inefficient to use in these applications. We present a solution allowing type safety in Java with little performance penalty. We do this by introducing a specialzed kind of object that provides distinct types for type checking, but which can always be removed entirely at compile time. In our implementation, programs are compiled twice, first with objects to verify type safety, and then with the objects removed for efficiency. This gives significant performance gains across a range of tests, including the generic SciGMark tests.


Object Type Polynomial Multiplication Java Code Primitive Type Type Safety 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Brown, W.E.: Progress toward Opaque Typedefs for C++0X (2005)Google Scholar
  2. 2.
    Johnston, B.: Java programming today. Pearson Prentice Hall, Upper Saddle River (2004)Google Scholar
  3. 3.
    Koffman, E.B.: Objects, abstraction, data structures and design using Java. John Wiley and Sons (2005)Google Scholar
  4. 4.
  5. 5.
    Watt, S.M.: Aldor. In: Grabmeier, J., Kaltofen, E., Weispfenning, V. (eds.) Handbook of Computer Algebra, pp. 265–270. Springer, Heidelberg (2003)Google Scholar
  6. 6.
    The Apache Ant Project (2010),
  7. 7.
    Bourdykine, P.: Type Safety without Objects in Java, MSc. Thesis, U. Western Ontario (2009)Google Scholar
  8. 8.
    Miller, B., Pozo, R.: SciMark 2.0 Java Benchmark. National Institute of Standards and Technology (2004)Google Scholar
  9. 9.
    Dragan, L., Watt, S.M.: Performance Analysis of Generics for Scientific Computing. In: Proc. SYNASC 2005, pp. 93–100. IEEE Press (2005)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Pavel Bourdykine
    • 1
  • Stephen M. Watt
    • 1
  1. 1.Department of Computer ScienceUniversity of Western OntarioLondonCanada

Personalised recommendations