I am trying to code some importance sampling algorithms, but I have a question about how importance sampling works.
Say we want to estimate the expected value of some function $h(x)$, with samples drawn from the distribution defined by the pdf $\pi(x)$, which is hard to sample, so we have the proposal distribution defined by the pdf $g(x)$. When does this algorithm work better, when $g(x)$ is similar to $\pi(x)$ or similar to $|h(x)|\pi(x)$?