compress folder pigz

C++
tar cf - ./folder_to_compress/ | pigz -9 -p NPROC > archive.tar.gz 	#With control on threads number
tar -I pigz -cf archive.tar.gz ./folder_to_compress/ #!!!!! No threads control, pigz will use all cores available
Source

Also in C++: