This wouldn't be a problem if the CPU-intensive code would be placed inside an extrinsic since we could benchmark it and get the accurate weight for the code.
But the problem is that we cannot benchmark a hook inside a pallet(e.g. We cannot benchmark the
on_initialize hook AFAIU).
If the code inside the hook is intensive because of reads/writes from the runtime we can use the
T::DbWeight::get().reads_writes(reads, writes) function which calculates the weight it takes for the specified number of reads&writes.
But what can I do if the code is actually CPU-heavy?