At the moment, pari_init is called with constant 1Mb of stack memory for each function that requires the binding to class group function.
optimize 1: remove pari_init when unnecessary
optimize 2: minimize allocated stack size
optimize 3: Make the stack size dynamic based on inputs.