Actually it is estimated that a person with a knife could be on you before you were able to draw your weapon and fire. I don't know if it's true, there have been many simulations made. I suppose it depends on the distance between the two people involved and how fast you are on the draw.
I read somewhere that most confrontations take place at 21 feet or less(7yds), it would not take long for an attacker to close that distance.