I already posted an article about the impact of a slow XScreenSaver when you suspend your machine. However if you wait for the screen to be effectively locked then a slow XScreenSaver will annoyingly delay going into sleep. The same apply if you often use your keyboard to lock your screen. And when I say slow I mean you can wait up to 6 entire seconds or more before you screen is effectively locked.
The reason behind this may be that some other program is grabbing the mouse or keyboard. If you want to investigate you may turn on XScreenSaver’s verbose mode and start it manually. Modify these two lines in ~/.xscreensaver :
verbose: False captureStderr: False
xscreensaver: 20:10:22: LOCK ClientMessage received; activating and locking. xscreensaver: 20:10:22: 0: locked mode switching. xscreensaver: 20:10:22: user is idle (ClientMessage) xscreensaver: 20:10:22: blanking screen at Mon Jul 29 20:10:22 2013. xscreensaver: 20:10:22: 0: grabbing keyboard on 0x81... GrabSuccess. xscreensaver: 20:10:22: 0: grabbing mouse on 0x81... AlreadyGrabbed. xscreensaver: 20:10:23: 0: grabbing mouse on 0x81... AlreadyGrabbed. xscreensaver: 20:10:24: 0: grabbing mouse on 0x81... AlreadyGrabbed. xscreensaver: 20:10:25: 0: grabbing mouse on 0x81... AlreadyGrabbed. xscreensaver: 20:10:26: couldn't grab pointer! (AlreadyGrabbed)
As you can see, XScreenSaver desperately tries to grab the mouse and refuses to lock until it finally gives up four seconds later. In my case it was unclutter which was grabbing it. Moreover I was using the -grab option and I guess this was causing the problem so you may just start the command this way instead :
unclutter -idle 5 -root &