sgb: boost optimization and better tracing