Open
Description
Issue: Pretty printing is very slow
Improvement: Add an option for plain-text printing (which should be very fast)
In Jupyter (and possibly other IDEs) rich color printing kernel SSA is extremely slow (slower than 10 lines per second if the kernel a few hundred lines). Most of the time, I don't care about color, I just want to see what's in the kernel quickly.
This is a workaround to print quickly. Let's add a nicer version of this to Method.print(color=False)
and add a color: bool=False
argument.
def fast_plain_print(kernel: kirin.ir.Method, **builtin_print_args) -> None:
import rich, io
with io.StringIO() as f:
kernel.print(console=rich.console.Console(file=f, no_color=True, force_jupyter=False, force_interactive=False, force_terminal=False))
f.seek(0)
print(f.read(), **builtin_print_args)