I think production code in any realtime environment, whether it be at Amazon or a trading desk at a bank, tends to converge towards crap just because of the time pressure on the developers.
I read a bank security audit report once... it made me very concerned about banking in general. It was astonishing how many glaring security blunders these banks were making -- and this was pervasive, neither isolated nor limited to small banks...
Good documentation and comments always seem like a hassle... until the first time you have to go fix a bug on something you wrote 18 months ago and have no clue how it works.
But they topped it off with extra special levels of stupidity: The vast majority of amazon's software ends up being written by juniors, and when they finally bring in seniors, they put the juniors on new systems and stuck the seniors with the task of adding features to the crap (because seniors are "good at wading into bad code").
Being weak in algorithms means that the author wouldn't be able to get in the door at amazon (which loves its juniors), but IMO that's a good thing, because I'd never want to work with someone who learned how to develop "production" software at amazon. (It was some of the worst code I'd ever seen -- and I went to amazon after over six years of government contractor work.)