Initial performance improvements

Here are some initial performance improvements. I'll write some unit tests in the maven branch and then see if there are more advanced performance improvement opportunities.

- Replace boxed numeric types with unboxed primitive types.
- Simplify some of the generic types.