Facebook wasn't exactly a performance king either. Their PHP codebase became a liability, leading them to create the HipHop compiler, HipHopVM, Hack, and other tools specifically for dealing with PHP and MySQL. Internally their first chat client had performance problems as well, leading them to rewrite it. They also no only had performance problems (and battery drain issues!) with their mobile interfaces, but also in controlled experiments intentionally broke pages to test their users' resulting behavior.
So I don't think I would ascribe the valuation difference to beginning engineering chops.
According to Adam D'Angelo (first CTO of Facebook, obviously a biased source) Facebook was able to implement features much faster than MySpace, which was a major competitive advantage for them. "I remember talking to an engineer who worked at MySpace who told me about how they had this huge list of regular expressions to try to prevent cross site scripting attacks, and whenever there was a new one they would make a new regex to try to fix it, rather than sanitizing html the right way."[0]
Friendster was too consumed with being led by a womanizing partier IIRC, which set the tone there... (this is anecdotal hear-say-info, so I could be wrong)... but as I recall it, they were too concerned with partying at the time to pay attention to what they were on the precipice of.
And it still ranks #174 in market cap. In relationship to Facebook it may not be successful, but in relationship to all of the startups by people who had "great ideas" but could not execute on the business side, it's doing well.
So I don't think I would ascribe the valuation difference to beginning engineering chops.