at few places, am facing some unhandled alerts, so for every click planning to check if alert is present, for that am using the following code,
public boolean isAlertPresent(){
    try{
        driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
        Alert a=driver.switchTo().alert();
        a.accept();
        return true;
    }
    catch (NoAlertPresentException e) {
        return false;
    }
    finally{
        driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
    }
}    
but the above code is taking some time to check whether alert is present, as I am going to use this method for every click, its too costly to wait, making the implicit wait zero in the above code has no effect. can anybody help on this.