Does the market system result in productive efficiency? In the long run, perfect competition?

Does the market system result in productive efficiency? In the long run, perfect competition?