Archive for the ‘Technology’ Category
Computer speed in numbers
The comparative speed of different components in a computer system is often a source of confusion. For example, a programmer could attempt to optimize their program by reducing the number of processor cycles needed to get something done, in exchange for needing one extra hard drive access, thinking that reducing their loop to one-tenth of its original size would surely provide more speed benefit than the hard drive access takes away.
To put things in perspective, I’ve assigned a number to each process available in a computer, to show their relative speed. (If something has a number of 13, that means in the time it can be performed once, something else with number 1 can be performed 13 times).
- 1 processor instruction (1/3 billionth of a second)
- 2 cache access
- 30 memory access
- 75,000 solid state drive (1/40,000th of a second (1) )
- 36,000,000 hard drive access (1/100th of a second)
- 480,000,000 dvd drive access
- 50,000,000 to 1,500,000,000 internet access (1/3rd of a second (2) )
This should really put things into perspective. A billion instructions worth of program can be executed before the first communication can be established with another computer on the internet across the globe. Of course, these are just rough numbers representing times to first access, but it should give you an idea how vast these differences are.
What this means for non-programmers is several things (these astounding numbers are the reason behind these common suggestions):
- if you backup all your pictures and documents to a hard drive or solid state drive, you’ll be able to access it much faster than if you make DVDs or use a backup website.
- copying commonly used items from cd onto a hard drive will make them open much faster
- if your computer feels like it’s slow, and you hear lots of hard drive access noises, buy more memory so that programs don’t need to resort to saving overflow from memory to hard disk.
- if you often work with games or Photoshop, or other programs that might need to access lots of files often, then a solid state drive could make your life a lot easier.
What this means for programmers is that, in the vast majority of programs, being even a little smart about not accessing drive storage or the internet can have more speed benefit than even the most clever hacks to speed up other program code. For example, instead of asking for the same information twice from the internet, save it to memory to re-use later, it will speed up a small portion of your program by at least one hundred million percent
.
Notes:
1) solid state drives are much faster at getting to files than hard drives, but sustained copying speed is similar.
2) internet access speeds vary depending on distance to the remote computer, and the quality of the link between the two computers. in general, you never know how long it will take.
My observations on interactions between Apple and Foxconn employees
I’ve been asked a lot by my friends how I feel about the recent Foxconn iPhone incident, where a Foxconn employee committed suicide after being accused of stealing an iPhone prototype. Having worked at Apple on the iPhone 3G and 3GS, spending almost half my time on Foxconn grounds and working with Foxconn employees in Southern China, I feel obligated to make a few observations.
First of all, I don’t know very much about this incident other than the details revealed by the press, so I can’t draw any conclusions about whether any stealing was going on or whether either company did anything wrong. However, both having seen the front lines of Apple and Foxconn employee relations, and being Chinese American, I can draw a few conclusions from my knowledge of the culture of both.
Apple is, in summary, American. People work hard on a product, driven by consumer demand and holiday shopping. High stress levels and long working hours are what employees have chosen through their own free will, and in return they get salaries, stocks, and the rush of developing the next big thing. People are willing to negotiate and yell at each other over what’s best for the product, and in the end the best solutions are chosen. Foxconn however, as expected, is much more engrained in a Chinese culture. There is a high regard for elders, both age-wise and in company position. Chinese people are very accommodating, to the point of sacrificing themselves. People work hard as well, not so much driven by satisfying shopping seasons, but by the need to please bosses and customers. The customers, in this case, are Apple.
The moment I landed in China I was put into a big VIP van with chauffeur carrying my luggage, given a gigantic VIP badge to hang around my neck, and guards stood up to salute when I walked by. And what did I do to deserve this? I worked for Apple. To this day I’ve felt the VIP badge to be a huge oversized eyesore that brought unnecessary hierarchy to what otherwise could have been a much healthier relationship. We solved engineering problems together, as expected. We worked hard together, as expected. We sat in boring meetings between lots of people from both companies, as expected. But what alarmed me, was where the yelling in those meetings was coming from, and to whom it was going to. Apple people yelled at each other, that was fine, whoever got yelled at, yelled back. But Foxconn never yelled back. The mega-monster VIP card breathed a massive force field to block any criticism aimed at Apple.
Well, to be clear, Foxconn was the one to require those VIP badges. Now why would a group of people choose to limit themselves as NOT EQUAL to another group? I think the Chinese culture of being accommodating and respecting status plays a role in this, and the long history of more hierarchy as well. I’ve definitely seen much less pride in Foxconn employees and more humbleness, which seems to fit my general gut feeling from meeting people in Southern China. One other factor is that Apple is in China, doing work speaking ENGLISH. Everyone at Foxconn needs to speak in their second language to communicate, and this automatically gives an impression that the Apple people are “better”. If you reverse that and Apple people had to learn Chinese, I wouldn’t be surprised if the Apple employees were more often the ones who look dazed and slightly confused, and the raising of the voices would come more from the Foxconn side.
Two experiences of mine really highlight how the two company cultures could come together to cause havoc, despite no one party intending any harm. On a Sunday afternoon, two Apple employees, Byron and I, were at the factory. As we worked, a man wearing a mask sprayed a mystery substance all around the area. We were pretty scared, and emailed some people to find out what it was, and why the guards outside were only provided small masks inadequate to protect from the spray. The two of us were some of few people from both companies who made good friends with the guards, and did not treat them as “subordinates”. To our surprise, the response we got from Foxconn was that Apple employees would be notified when the next spraying would occur. Where was the respect for your own health, for the health of our friends who have to work as guards on Sundays? Do they deserve more deadly bug spray than higher ranking managers? To be frank, they probably deserve much less. Later as I recall, was a comment from an Apple employee about how the bathrooms smelled. Foxconn then closed the bathroom to its own workers and made it “VIP Only”. Despite being a polite gesture to solve a problem of bathroom overcrowding, by coincidence it ended up being rich predominantly white Americans being able to use the bathroom, while all the Chinese kids working for low wages weren’t able to access their own bathroom. I was not willing to tolerate any of this. I emailed a huge group of people, included directors and HR, and caused a huge ruckus. And I loved it, since it sent a bunch of people scrambling, and fixed the situation immediately.
In both the experiences, no one from either Apple or Foxconn intended to do any harm, though the end result wasn’t too good. To apply to the current situation where the Foxconn employee committed suicide, I see these factors at work to cause problems out of something very small. Foxconn tends to treat anything Apple as the most important thing it’s ever touched. And Apple tends to be very anal about keeping track of iPhones so that no information leaks. So a combined culture of a one-sided subordinate relationship between Apple and Foxconn, and the worship of the iPhone’s secrecy as the most important aspect of the job, quickly spirals into what happened recently. My guess is that he didn’t steal the phone, and that it was a simple accident of the phone gone missing. After all, working in our offices in Cupertino phones would often go missing for days when coworkers take them to work on in their own offices. In this way Apple employees and Foxconn employees definitely get different treatment. My personal opinion is that no consumer product should be worth a person’s life, no matter how much money that product launch can make. The two companies will really need to figure out these cultural differences to make their relationship more level. I really don’t think Apple did anything to cause this incident, but I’m not saying that Apple has done too much to make sure they are treating their factories in the most respectful manner either.
My shuffled playlist is not very random!
Sometimes pressing “shuffle” on my iPhone or iPod to shuffle my playlist into random order can cause a little confusion.
Are you sure this is random? Maybe the random number generator used in the shuffling software is broken? If it’s truly random, how come it keeps playing the same song from the same singer that I don’t like that much? I feel like when I press “shuffle”, it’s not guaranteed that the order of the songs is random.
Well, I think there’s a reasonable explanation for this. What the computer considers random, is truly random. I’ve thought through how the human mind thinks about this, and what we consider random, goes something like this:
- When an artist is played, the next song (and the next next song) should not be by that artist again, no matter what.
- Songs of different genres should be balanced, so that songs of one type shouldn’t bunch up.
- My favorite songs should be played more often. The more I like it the more often it should play.
- When a song has played, it shouldn’t come up again later.
- 6 or more songs in a row sung by artists of the same skin color and/or country is a strong indicator that the playlist is not randomly ordered.
You may have noticed that this is very difficult to achieve, especially considering that #3 and #4 conflict with each other. Perhaps for someone with these criteria for “randomness”, they will never be satisfied that their playlist is indeed random (Maybe #4 should really be “When a song has played, it shouldn’t come up again later… unless I like it.”?). A human perception of a randomized playlist is almost completely a carefully hand-selected mix of their favorite songs. In any case, the shuffle feature could probably use some additions to make it more “random” =).
You are currently browsing the archives for the Technology category.