See Weapon Speed for tables summarising this information.
When deciding between two different weapons, it can be helpful to understand exactly how attack speed works. Each physical attack in Crawl causes a certain amount of delay, which is the amount of time measured in auts before you can act again. A character with a small attack delay will swing more frequently than a character with a large attack delay. As this greatly multiplies the damage you can inflict in combat, it is strongly recommended to get your attack delay as low as possible.
Base and adjusted attack delay
The base attack delay of a weapon is listed upon examination. For example, examining a hand axe shows that its speed is 130%. To convert this to base delay, simply chop off the last 0. Our hand axe has a base delay of 13, meaning it takes 13 auts to recover from your attack.
Having skill levels in a weapon's associated skill will decrease this delay. Take your weapon skill and divide it by two, rounding down. Subtract the result from the weapon's base delay to determine your adjusted delay. So if you have a skill of 2 in Axes, your hand axe would have an adjusted delay of 12. As soon as you reached a skill of 4 in Axes, the adjusted delay would decrease to 11.
Weapons can't just keep getting faster and faster. All weapons have a minimum delay. Once reached, gaining more weapon skill won't decrease the delay any further (but will still slightly improve your damage and accuracy). To find out the minimum delay for a particular weapon, take the base delay, divide it by two, and drop the remainder. So, our hand axe with a base delay of 13 has a minimum delay of 6. That means that our weapon skill can at most lop seven points off of the hand axe's base delay. Once you hit an Axe skill of 14, that hand axe is going to be swinging as fast as it is going to get.
There are a couple of exceptions to the minimum delay calculation. First, if the weapon in question is a short blade and the calculated minimum delay is larger than five, then the minimum delay is adjusted to five. As a result, even though cutlasses have a base delay of 12, their minimum delay is 5 instead of 6.
The second exception is if the calculated minimum delay is larger than 7. In such a case, the minimum delay is set to 7. This mostly happens with big two handed weapons. Because of this exception, an executioner's axe with a base delay of 20 has a minimum delay of 7 instead of 10.
There is also a hard-coded minimum weapon delay of 3. If the calculated minimum delay is less than 3, it gets set to 3.
The speed brand comes into effect after the check against the minimum attack delay is done. A weapon with the speed brand will attack faster than the calculated minimum delay. Attacks made with speed branded weapons take only 66% as long as normal. If a weapon's normal speed can't divide cleanly into thirds, then the speed of each attack will be rounded up or down to the nearest integer.
Shields can potentially add extra delay to your attacks. To calculate the delay added, you first need to know your adjusted shield penalty:
Adjusted Shield Penalty = Base Shield Penalty - (Shields skill/Racial Modifier)
The base shield penalty is 0.8/3/5 for bucklers/kite shields/tower shields, and the racial modifier is 3/5/7/9 for large/medium/small/little characters. Throw away any remainder on the division. So a medium size character would have an adjusted shield penalty of 0 when wielding a buckler at shield skill 4, a shield at shield skill 15, and a large shield at shield skill 25.
After calculating your adjusted shield penalty, the game selects two random integers between 1 and your adjusted shield penalty. The smaller one is used as the delay added by the shield. Once your adjusted shield penalty reaches 0 there is no added delay.
At this point, if the weapon delay plus the shield delay is less than 3, it is set to 3, but this is something that never happens.
So, now we have an adjusted weapon delay after taking our weapon and shield into consideration. We aren't done yet. If slowed or in Statue Form, this value is multiplied by 1.5. If we are hasted or berserk, it is divided by 1.5. Under Finesse, it is divided by 2. The result of this calculation is an integer, but whether it is rounded up or down is randomized, weighted by the remainder.
For example, say you are wielding a demon whip, and have enough mace skill to reach the minimum delay of 5. You berserk. The berserk divider is 1.5, so your delay value is 3.333. Delays must be integer values though, so 2/3 of the time your delay will be rounded to 3, and 1/3 of the time your delay will be rounded to 4. In effect, you get your delay of 3.333.
The smallest delay you are allowed to swing with is 2. If the final calculation spits out a value less than 2, it is set to 2. That means that you only receive half the speed bonus of Finesse if your mindelay is already 3 (Bear in mind that this still results in a massive boost to damage output).
The functions which calculate the delay can be found in melee_attack.cc. See melee_attack::calc_attack_delay and its sub-functions.