I've made some changes to the freehand code. We now do better estimation of initial & final tangent. I've also got rid of the ghost spike problem.
You may wish to experiment with the pencil tolerance setting (double-click on the pencil tool) and/or the array size in src/pencil-context.h.
I was going to increase the array size from 16 to 256:
* src/pencil-context.h: Increase maximum number of data points per bezier from 16 to 256. This results in longer curve segments, and more CPU time, and greater importance of having a small tolerance value in the pencil settings (say 2.5 or 3).
but am inclined to prefer the existing size of 16, despite the theoretical advantages of the larger buffer. I think this reflects either that we need to be smarter about the tolerance value (perhaps using the speed idea mentioned elsewhere in this thread) and/or "guess what radius of curvature the user intends" as Bulia suggested in reply. At first that sounds as if it requires telepathic I/O, but we could get results by being more explicit about what curves are more likely than others.
A change that would improve things for fairly straight curves (fairly large radius of curvature) is the pending patch that allows more than one uncommitted (red) bezier segment, rather the existing code where the tangent at nodes is chosen solely from the data points that come before the node.
An extreme version of that is suggested by Joshua / Illustrator, where we don't commit any of the curve until mouseup.
Maybe the array size can be increased to such a large value once one of those changes has gone in. For the moment, try playing around with values near the existing 16.
pjrm.