I'm posting my patch for this bug again. It stills shows a 3-3.5 improvement over the current code in wid-edit.el, and together with the changes Roland made, it brings the time needed to create the buffer from 20+ seconds to about 4 seconds in my machine. Profiler data has not changed much from the ones I posted back then.