P
Patricia Shanahan
Benjamin White wrote:
....
If you want to learn to write fast code, you may find it helpful to
start with a good process. If I am going to hand tune some code, I start
by making sure I have:
1. A unit test. The unit test may simply compare the implementation
being tested to the existing implementation, but must cover a lot of
edge cases.
2. A performance test. The performance test, or tests, cover only common
cases, but do enough of them for meaningful timing.
Without those, it is hard to know whether the tuned version is, in fact,
a faster version of the same function. It may be a slower implementation
of the same function, or even not be an implementation of that function
at all.
Patricia
....
....My first goal is to just learn to write fast code in theory, a good
algorithm. The package may run on many different JVMs and hardware. I
would want to code for one type of environment and make to others suffer.
If you want to learn to write fast code, you may find it helpful to
start with a good process. If I am going to hand tune some code, I start
by making sure I have:
1. A unit test. The unit test may simply compare the implementation
being tested to the existing implementation, but must cover a lot of
edge cases.
2. A performance test. The performance test, or tests, cover only common
cases, but do enough of them for meaningful timing.
Without those, it is hard to know whether the tuned version is, in fact,
a faster version of the same function. It may be a slower implementation
of the same function, or even not be an implementation of that function
at all.
Patricia