The log pdf isn't expensive, if you use the following shortcut:
Starting with
log_pdf = log (1.0/ (sigma * 2.0 * pi)) - 0.5 * square(x-mean) / ( sigma*sigma );
you can see that the part of the term containing the log can be pre-calculated for any particular PDF, as can part of the rest. So for any given values for the standard deviation and the mean:
log_k = log (1.0/ (sigma * 2.0 * pi));
half_over_sigma_sq= 0.5 / (sigma*sigma)
Then when evaluating for lots of different values of x, you can calculate just
log_pdf = log_k - half_over_sigma_sq * square(x-mean);
This trick is used all the time in statistical modelling.