Performance

English: An example of the newly-designed Guin...

English: An example of the newly-designed Guinness glass, put into use in April 2010. It was designed to gradually replace the older tulip-shaped glasses. (Photo credit: Wikipedia)

An excited member of my team once came up to me and told me he’d sped up a subsystem by a factor of 700 times. Once he ran some full system tests, we found that the optimisation had absolutely zero performance impact on any observable aspect of the system. The online requests still took the same amount of time. There was an overnight batch that took almost exactly the same time as before we applied the optimisation. The guy was crestfallen.

How many times have you been on the phone to your bank and the operator says something like “Sorry for the delay Sir, the computer’s really slow today”? Performance problems are an annoyance. Unless things are really bad, you can typically use the system, but it’s slow. We human beings are an impatient lot, so the annoyance level of a system taking 5 seconds to respond instead of 1 is higher than you might expect.

There is some mystique about the performance of a system. With good reason. To really understand performance, you need to understand a hell of a lot about the 1s and 0s that are flying around at the lower level. You need an understanding of what’s happening at the hardware level to make sure there are no bottlenecks there. Sometimes it might be the operating system running out of resources or perhaps the database. It might even be the application code itself. A good performance expert will have many years of experience and an intuitive grasp of what’s going on at every level.

It usually boils down to three different types of problem. Either the tasks in the system are taking too long, or there are too many tasks going on or there is contention.

Suppose you have a bar. Suppose that each time the barman serves a customer, he has to go next door and buy a glass. Each customer interaction is going to take a long time. Adding more barmen is the wrong approach. To fix the performance problem, you need to have a shelf full of glasses that the barman can use whenever a customer places an order. You also need to make sure the shelf gets restocked.

Suppose 20 thirsty people turn up. Now, there is contention for the barman. Cutting the amount of time the barman takes to serve each customer will help, but adding more barmen would probably help more.

Suppose 14 coach loads of thirsty Irishmen turn up on the way back from a rugby match. Now you’ve got a real problem. Not only have you got too many customers to serve, and you have contention on the bar staff, the chances are that a good proportion of them are going to order Guinness (the drink that takes the longest time to serve). To add insult to injury, they’ve probably spent all their money at the match so many of them will also be paying by credit card.

In this example, you’ve got multiple examples of all 3 types of problem at once, which is typically how it goes when you are looking at a complex application. So the next time you’re on the phone to the call centre and the system’s slow, cut them some slack. And spare a thought for the poor sod in the back room who’s trying to work out why.

Advertisements

Look and feel

English: This is a general-purpose alphanumeri...

English: This is a general-purpose alphanumeric LCD 한국어: 범용 액정 디스플레이 (Photo credit: Wikipedia)

The device itself was rudimentary. Nothing more than a cheap metal casing which housed a small two-line LCD display and a flat ZX81 style keyboard.

“Can you make it look exactly like that?”

The assignment was for a large national breakdown operator and the devices lived in drivers’ cabs. They allowed simple communication between the drivers and the operators in headquarters. The original manufacturers of the units was now bankrupt and the customer wanted to replace them with cheaper modern commodity hardware. Ultimately, they wanted to enhance the units to offer much more functionality, but for phase 1, they didn’t want to scare the horses. After all, training a huge fleet of breakdown truck drivers would take some time.

My colleague studied the unit whilst mentally appraising the effort involved in replicating the look and feel of the user interface.

“As long as you leave one with us.”

So how hard would it be? Seeing as the hardware dictated that the only realistic programming language was Microsoft Visual C++, the answer was very hard indeed. Almost everything in C++ takes a surprising amount of code but if my colleague stood any chance of replicating the finer nuances of the device, he would have to resort to the dreaded owner-draw control. For ordinary controls which come as part of the operating system, Windows does all the hard work of drawing them every time something on the screen changes. For an owner-draw control, you have to write code. Reams and reams of it.

He took ages on those buttons. Firstly he studied the original, taking measurements and looking at everything through a magnifying glass to make sure he had the finer detail. The text on the buttons was not a standard Windows font either so on top of everything, he would have to create a custom font.

More than once I heard an “Aaaaaaaarrrgggh” from over the cubicle partition as he fought with the inner nuances of operating system libraries. After a month or so, he was ready for the first customer demonstration. I checked out his handiwork. It was an impeccable replica of the crude user interface. When the customer came in to see it, his brow wrinkled.

“Is there something wrong?”

“I was hoping you might smarten up the buttons to make them a bit more standard. You know, like the 3D look and feel you get with a Windows button?”

A quick look at my colleague’s face told me he was mentally counting to ten. A few moments clarifying what “exactly like” meant would have saved weeks of effort and considerable angst. Unfortunately, people specify things like this all the time and are usually disappointed with the result for some reason.

So why do they do it? They do it because it’s easy and requires little or no effort. Care and attention spent on requirements is seldom wasted.

Inexplicable equipment failure

English: Picture of a laptop running a present...

English: Picture of a laptop running a presentation using presenter’s view. (Photo credit: Wikipedia)

As anyone in sales will tell you, preparation is key, so I was glad we had taken the opportunity to meet up before the presentation. I was in pre-sales and the prospect was a defence company not far from GCHQ. There was a handy garden centre just outside the facility, and it was there that the salesman and I went through a dummy run of our dog and pony show.

By and large, he was happy with my presentation and apart from a few minor cosmetic changes, we were good to go. We finished our tea and I packed away my laptop in good time for the meeting ahead. Security at the site was pretty strict and it was a good job we had left plenty of time. After half an hour or so, we headed through the labyrinthine passages to the meeting room.

I immediately set about plugging my laptop into the projector, knowing from bitter experience that they could be quite fickle and it takes time to get the laptop and the projector to agree on a suitable resolution. I hit the power button on the laptop to fire it up, and nothing happened. Strange, it was working perfectly half an hour ago. I plugged in the power supply, still nothing. I removed the battery and replaced it – nothing.

Panic set in. People were filing into the room for the presentation. Having exhausted all of my rudimentary problem solving skills, I gave our IT man back in the office a call. He’d know what to do – he always does. But he suggested exactly the same things I’d already tried. Out of desperation, I tried them again – to no avail.

The salesman, usually a calm, stoic force in a chaotic world started to get nervous. “What’s wrong?” he whispered to me. “I don’t know” my tense reply. “It was working half an hour ago” he insisted. After another 5 minutes of frantic fiddling, for no apparent reason – the thing burst into life.  My relief was palpable – I think I kissed the laptop.

When I returned to the office, I related the tale to a colleague and he told me that the exact same thing happened to him when he visited the same prospect a couple of weeks beforehand. All we can imagine is that there is some kind of equipment in the area (maybe as part of the security checks) that temporarily knocks out laptops.

Inexplicable equipment failure.

Why is it that the DVD player in the car never works after a trip to St Ives? Why when I visit Athens does my phone run ultra hot and run out of charge in no time flat? Why is it that whenever Mrs B. tries to get the laptop to do something, she ends up all hot and bothered. Why does the mother in law’s laptop inexplicably tune into the wrong wireless router even though I have been up there and obliterated all trace of that machine from the config?

I know some people who can’t wear watches because they stop working and no amount of winding or battery changing will persuade them into life. Whichever piece of electrical equipment my brother touches has a very finite lifespan.

There are some powerful forces at work and I have no idea how they work – all I know is that they cause inexplicable equipment failure.

Daisywheels, golfballs, thermals and lasers

From wikipedia commons.

From wikipedia commons. (Photo credit: Wikipedia)

If anyone ever had a Sinclair Spectrum, they probably remember the little ZX printer designed to be plugged into the back. Designed like an electric toilet roll dispenser, it used a roll of silver thermal paper. Inside, little pins literally burned into the thermal paper to leave behind (sort of) recognisable print. The poor thing used to get tired and slow down towards the end of a large print job and you almost ended up feeling sorry for it.

If the print was difficult to read when first produced, the fading over time meant that it was totally unreadable after a few days. Those in the know used to spray their printouts with hairspray to extend their longevity.

When I started work, there was one printer to rule them all. A dirty great big behemoth of a printer connected to the mainframe. Almost all processing happened overnight because it cost less and any output from that processing went not to a screen, but onto paper; tons of it. I don’t know how these printers used to work, but they were lightning fast and the paper was warm with a distinctive smell. All the screens in the building were dumb terminals so there was no concept of local printers.

As and when PCs started to appear, people wanted to print things which meant they needed a printer. The first such devices were dot matrix printers. Brutally mechanical affairs, they used a print head made up of a matrix of hammers which formed the print by bashing through an ink soaked ribbon onto the paper. If that sounds noisy and slow, they were. Each agonising line of print sounded like a mini machine gun.

The print quality was awful and if your printer happened to be more than 12 months old, the pins had a nasty habit of getting misaligned which made the text barely readable.

Daisywheel printers had a radial print head with characters on the end of spokes. When these struck the paper through the ribbon, a whole character came out. Golf ball printers worked the same way, only the characters were all stuck onto a small ball. These cut down on the noise and the print quality improved enormously, but they were limited to a single font.

Nowadays with inkjet and laser printers coupled with ever more sophisticated software, there is almost no limit to what can be printed at low cost, but they are restricted to two dimensional paper.

With 3D printing, which is widely used in industry, layers of material are laid down according to a digital blueprint in order to construct a physical object. Suddenly, almost anything can be manufactured one piece at a time if you have the right kit. The printers are tumbling in price, so it won’t be long before there are no limits on what you can create in your own home.