No. The longsword has a higher attack bonus and strength bonus. It has a primarily slash attack as well. Both of these characteristics make it a good weapon to use against boss monsters. The rapier has a strong stab bonus, and the primary method of using it is stabbing. Most bosses have a good stab defence. Most slayer monsters do not. Even though it has a weaker attack bonus, the attack speed far surpasses that of the longsword. This enables you to get in more hits within the same time frame of using the longsword in addition to exploiting that weakness to stab defence. This is a similar reason to why people picked whips over Godswords, although without the stab option.