Check out this section of the Turing performance tips:
https://turing.ml/dev/docs/using-turing/performancetips#special-care-for-codetrackercode-and-codezygotecode
Instead of preallocating your arrays and then filling them using a loop, you probably want to use filldist (for your priors) and arraydist (for the Poisson observations). For instance, you’d initialize the prior for a like
a ~ filldist(InverseGamma(a1, b1), J)
and you’d write the observation likelihood as
x ~ arraydist(Poisson.(rate))