I am genuinely impressed at how bad you managed to get the performance to be for something so simple. If you did this as a learning experience you'd do well to put it through a profiler.