performance considerations

This is the very beginnings of work to optimize performance of the loader.
According to Chrome's warnings, it stops the function it is used in from being optimized.