Optimized function initPrint()

Signed-off-by: lettleprince <tong.decula@163.com>