How to combine multiple wp_insert_post into one in order to gain better performance

I would advise using wp_insert_post() and putting you text files into a CSV

CSV

Post Title,Post Content,
"title", "content",
"title", "content"...

PHP

 $path = "/posts.csv";

        //require __DIR__ . "$path";
        $file = fopen(__DIR__ . $path, 'r');
        while (($line = fgetcsv($file)) !== FALSE) {
            //$line is an array of the csv elements                 
            $post["id"] = wp_insert_post( array(
                "post_title" => $line[0],
                "post_author" => 1,
                "post_content" => $line[1],
                "post_type" => 'page', //add post type
                "post_status" => "publish"
            ));
        }
        fclose($file);

Or you could do a SQL INSERT, have a look at – https://stackoverflow.com/questions/1670838/inserting-a-post-in-wordpress-using-mysql

 $sql = "INSERT INTO `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES ";
 $sql .= "(' ','".$post_author."',"."'".$post_date."',"."'".$post_date_gmt."',"."'".$post_content."',"."'".$post_title."',"."'".$post_excerpt."',"."'".$post_status."',"."'".$comment_status."',"."'".$ping_status."',"."'".$posd_password."',"."'".$post_name."',"."'".$to_ping."',"."'".$pinged."',"."'".$post_modified."',"."'".$post_modified_gmt."',"."'".$post_content_filtered."',"."'".$post_parent."',"."'".$guid."',"."'".$menu_order."',"."'".$post_type."',"."'".$post_mime_type."',"."'".$comment_count."'),";
 $res = mysql_query($sql); if($res): print 'Successful Insert'; else: print 'Unable to update table'; endif;