当前位置:   article > 正文

c++ 筛选裁决文书 1985-2021的数据 分析算法的差异

c++ 筛选裁决文书 1985-2021的数据 分析算法的差异

c++ cpp 并行计算筛选过滤 裁决文书网1985-2021 的300g数据

数据
在这里插入图片描述
数据解压以后大概300g,最开始是使用python代码进行计算,但是python实在太慢了,加上多进程也不行,
于是 使用c++ 进行 计算
c++这块最开始使用的是 i7-9700h 用的是单线程,使用三个程序程序同步计算,大概需要2-3个小时的样子。

改成c++多线程,电脑换成i9-12900h 20核心的,就快得多了。
最多也就是30分钟

解压的时候,是使用python调用zip,多进程进行解压,python解压代码如下:
python代码写的也能看出来,最开始其实就是用单线程,但是也是很慢,不过我用的多进程的时候,也是慢,原因是 磁盘io到达最大,这里教训我以后要尽量找个磁盘io大的程序


import traceback
import os
import shutil
import sys


def get_all_file(path):
    # import os
    return_list=[]
    for root,dirs,files in os.walk(path,topdown=True):
        for file_one in files:
            use_path=root+'/'+file_one
            return_list.append(use_path.replace('/','\\'))
    return return_list


# w文件区域。
main_path=os.getcwd()  # exe文件存放的路径。

import os
import zipfile

# 定义zip文件所在的目录
zip_dir = './3669万专利申请全量数据1985-2022年'
zip_dir = './zhongguo_caijue_ziliaoku/main_zip'

# 遍历目录下的所有文件

# for file_name in get_all_file(zip_dir):
#     if file_name.endswith('.zip'):
#         # 构建zip文件的完整路径
#         # zip_path = os.path.join(zip_dir, file_name)
        
#         zip_path= file_name


#         # 创建一个与zip文件同名的文件夹来存放解压后的文件
#         output_dir = os.path.splitext(zip_path)[0]
#         os.makedirs(output_dir, exist_ok=True)
        
#         # 打开zip文件
#         with zipfile.ZipFile(zip_path, 'r') as zip_ref:
#             # 解压zip文件到指定的输出目录
#             zip_ref.extractall(output_dir)
        
#         print(f'Successfully extracted {file_name} to {output_dir}')

def get_zip_fuc(file_name,mi):

    if file_name.endswith('.zip'):
        # 构建zip文件的完整路径
        # zip_path = os.path.join(zip_dir, file_name)
        
        zip_path= file_name


        # 创建一个与zip文件同名的文件夹来存放解压后的文件
        output_dir = os.path.splitext(zip_path)[0]
        os.makedirs(output_dir, exist_ok=True)
        
        # 打开zip文件
        with zipfile.ZipFile(zip_path, 'r') as zip_ref:
            # 解压zip文件到指定的输出目录
            zip_ref.extractall(output_dir)
        
        print(f'Successfully extracted {mi} {file_name} to {output_dir}')

import multiprocessing

if __name__ == '__main__':

    pool = multiprocessing.Pool(processes=20)
    # main_len = len(node_n2_list_list)
    for mi,file_name in enumerate(get_all_file(zip_dir)):
        pool.apply_async(get_zip_fuc, args=(file_name,mi))
        
    pool.close()
    pool.join()



  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82

在这里插入图片描述

在这里插入图片描述

回到c++计算这里,对于 多文件,单个文件也很大的程序,我采取的做法是比较简单的,也就是一个线程负责一个文件的计算筛选,通过线程锁来提取对应的程序。

// by guangdu  wx:wo15985300747 
// 有需要用c++加速计算的可以联系我,我可以给你封装为各种各样语言的实现
// 大数据处理的也可以一起聊聊
// 复杂网络也是一样哦

#include "pool_number.cpp"
#include <thread>
#include <iostream>
#include <chrono>
#include <vector>
using namespace std;

int cpu_number(){
    // SYSTEM_INFO sysInfo;
    // GetSystemInfo(&sysInfo);
    // unsigned int numCores1 = sysInfo.dwNumberOfProcessors;
    // return numCores1;

    unsigned int numCores = std::thread::hardware_concurrency();
    return numCores;
}



# include <iostream>
#include <windows.h>
#include <string>
#include <basci/basci.h> //

using namespace std;


#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

#include <iostream>
#include <fstream>
#include <vector>
#include <string>

using namespace std;

vector<vector<string>> read_csv(string filename)
{

    vector<vector<string>> data;
    ifstream file(filename);

    if (!file.is_open()) {
        cerr << "Failed to open file: " << filename << endl;
        return data;
    }

    enum State { UnquotedField, QuotedField, QuotedQuote };
    State state = UnquotedField;

    vector<string> row;
    string field;
    char c;

    while (file.get(c)) {
        switch (state) {
            case UnquotedField:
                switch (c) {
                    case ',': // end of field
                        row.push_back(field);
                        field.clear();
                        break;
                    case '"': // start of quoted field
                        state = QuotedField;
                        break;
                    case '\n': // end of row
                        row.push_back(field);
                        data.push_back(row);
                        row.clear();
                        field.clear();
                        break;
                    default:
                        field.push_back(c);
                        break;
                }
                break;
            case QuotedField:
                switch (c) {
                    case '"': // end of quoted field
                        state = QuotedQuote;
                        break;
                    default:
                        field.push_back(c);
                        break;
                }
                break;
            case QuotedQuote:
                switch (c) {
                    case ',': // comma inside quotes
                        row.push_back(field + "\"");
                        field.clear();
                        state = UnquotedField;
                        break;
                    case '"': // escaped quote
                        field.push_back('"');
                        state = QuotedField;
                        break;
                    case '\n': // end of row
                        row.push_back(field);
                        data.push_back(row);
                        row.clear();
                        field.clear();
                        state = UnquotedField;
                        break;
                    default: // end of quote
                        row.push_back(field);
                        field.clear();
                        state = UnquotedField;
                        break;
                }
                break;
        }
    }

    if (!field.empty()) {
        row.push_back(field);
    }

    if (!row.empty()) {
        data.push_back(row);
    }
    file.close();
    // 减少复制的损耗
    return std::move(data);
}




#include <iostream>
#include <fstream>

using namespace std;

int getFileSize(string filePath) {
    ifstream file(filePath, ios::binary | ios::ate);
    int size = file.tellg();
    file.close();
    return size/(1024*1024);
}


#include <chrono>
#include <chrono>
#include <ctime>
#include <iomanip>
#include <sstream>
#include <string>

std::string getCurrentTimeStr() {
  // 获取当前时间
  auto now = std::chrono::system_clock::now();
  std::time_t time = std::chrono::system_clock::to_time_t(now);

  // 将时间格式化为字符串
  std::stringstream ss;
  ss << std::put_time(std::localtime(&time), "%Y_%m_%d_%H_%M_%S");
  return ss.str();
}

// bool write_in(string xx, vector<string> dd_list) {
//     for (const auto& str : dd_list) {
//         if (xx.find(str) != string::npos) {
//             return true;
//         }
//     }
//     return false;
// }

bool write_in(string xx, const vector<string>& dd_list) {
    for (const string& str : dd_list) {
        if (xx.find(str) != string::npos) {
            return true;
        }
    }
    return false;
}


// #include <iostream>
// #include <vector>
// #include <string>

// std::ostream& operator<<(std::ostream& os, const std::vector<std::string>& vec) {
//     os << "[";
//     int i=0;
//     for (auto it = vec.begin(); it != vec.end(); ++it) {
//         // if (it != vec.begin()) {
//         //     os << ", ";
//         // }
//         os <<"   "<<i<<" "<< *it<<endl;
//         i=i+1;
//     }
//     os << "]";
//     return os;
// }


// void write_csv_file(string file_name,vector<vector<string>> main_list){
// }

/*
#include <fstream>
#include <iostream>
#include <vector>
using namespace std;
void write_csv_file(string file_name, vector<vector<string>> main_list) {
    ofstream file(file_name);
    if (file.is_open()) {
        for (vector<string> row : main_list) {
            for (int i = 0; i < row.size(); i++) {
                string cell = row[i];
                if (cell.find_first_of(",\"\n") != string::npos) {
                    file << "\"";
                    for (char c : cell) {
                        if (c == '\"') {
                            file << "\"\"";
                        } else {
                            file << c;
                        }
                    }
                    file << "\"";
                } else {
                    file << cell;
                }
                if (i < row.size() - 1) {
                    file << ",";
                }
            }
            file << "\n";
        }
        file.close();
    } else {
        cerr << "Unable to open file: " << file_name << endl;
    }
}
*/


#include <fstream>
#include <iostream>
#include <vector>
using namespace std;

void write_csv_file(string file_name, vector<vector<string>>* main_list) {
    ofstream file(file_name);
    if (file.is_open()) {
        for (vector<string>& row : *main_list) {
            for (int i = 0; i < row.size(); i++) {
                string& cell = row[i];
                if (cell.find_first_of(",\"\n") != string::npos) {
                    file << "\"";
                    for (char c : cell) {
                        if (c == '\"') {
                            file << "\"\"";
                        } else {
                            file << c;
                        }
                    }
                    file << "\"";
                } else {
                    file << cell;
                }
                if (i < row.size() - 1) {
                    file << ",";
                }
            }
            file << "\n";
        }
        file.close();
    } else {
        cerr << "Unable to open file: " << file_name << endl;
    }
}




#include <iostream>
#include <chrono>
#include <ctime>
#include <cstdlib>

using namespace std;




#include <iostream>
#include <thread>
#include <mutex>

std::mutex mtx;  // 定义一个互斥锁

int now_sum_id_number;





vector<vector<string >> re_vector_2d_list_fuc(int fi,int main_i,int main_len,long long csv_i,string read_file,string new_path,int main_number,vector<string> str_list ){

    std::unique_lock<std::mutex> lock(mtx, std::defer_lock);  // 定义一个未加锁的unique_lock


    // 读取一个csv文件,获得其中的内容
    enum State { UnquotedField, QuotedField, QuotedQuote };
    vector<string> row;
    string field;
    char c;
    State state;

     auto start_time = std::chrono::high_resolution_clock::now();
     std::chrono::time_point<std::chrono::high_resolution_clock> end_time;
     vector<vector<string >> data_list;

     // int main_len =  main_list.len();

    // for (node *p = main_list.head->next; p != main_list.head; p = p->next) {
        cout<<endl<<endl;
        cout<< main_i<<"/"<<main_len<<"  "<<fi<<"  "<<getFileSize(read_file)<<"  "<<gbktoutf8(read_file)<<endl;
        main_i = main_i+1;

        ifstream file(read_file, std::ios::in);
        if (!file.is_open()) {
            cerr << "Failed to open file: " << read_file << endl;
        }

        state = UnquotedField;
        while (file.get(c)) {
            switch (state) {
                case UnquotedField:
                    switch (c) {
                        case ',': // end of field
                            row.push_back(field);
                            field.clear();
                            break;
                        case '"': // start of quoted field
                            state = QuotedField;
                            break;
                        case '\n': // end of row
                            row.push_back(field);
                            // data.push_back(row);


                            // fi=fi+1;
                            // if(fi%100000==0){
                            //     end_time = std::chrono::high_resolution_clock::now();
                            //     // cout<<"fi  "<<fi<<"  "<<std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count()<<"   "<<row.size()<<endl;
                            //     // cout<<"fi  "<<fi<<"  "<<(std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count())/ 1e6 <<"   "<<row.size()<<endl;
                            //     cout<<"       sum_row_number "<<main_number<<"  "<<fi/10000<<"   time[s] "<<(std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count())/ 1e6 <<"   row_size "<<row.size()<<"    "<<row[10] <<endl;
                            //     // cout<<"file fix  "<<fi/10000<<"  "<<std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count()<<"   "<<row.size()<<"  "<<gbktoutf8 (p->str )<<"    "<<row[10] <<endl;
                            //     // cout<<row<<endl;
                            //     // cout<<"    "<<row[10]<<endl;
                            // }

                            if(write_in(gbktoutf8(row[10]),str_list)){
                                ;//执行写入
                                data_list.push_back(row);
                                main_number= main_number+1;
                                if(main_number%10000==0){
                                    end_time = std::chrono::high_resolution_clock::now();
                                    // cout<<"清空与整理a "<<main_number<<endl;
                                    cout<<"       sum_row_number "<<main_number<<"  "<<fi/10000<<"   time[s] "<<(std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count())/ 1e6 <<"   row_size "<<row.size()<<"    "<<row[10] <<endl;

                                    lock.lock();  // 手动开启线程锁
                                        now_sum_id_number = now_sum_id_number+1;
                                    lock.unlock();  // 手动关闭线程锁



                                    write_csv_file(new_path +"/"+to_string(now_sum_id_number)+"  "+ to_string(csv_i)+".csv",data_list);
                                    data_list.clear();
                                    csv_i=csv_i+1;

                                }
                            }


                            row.clear();
                            field.clear();
                            break;
                        default:
                            field.push_back(c);
                            break;
                    }
                    break;
                case QuotedField:
                    switch (c) {
                        case '"': // end of quoted field
                            state = QuotedQuote;
                            break;
                        default:
                            field.push_back(c);
                            break;
                    }
                    break;
                case QuotedQuote:
                    switch (c) {
                        case ',': // comma inside quotes
                            row.push_back(field + "\"");
                            field.clear();
                            state = UnquotedField;
                            break;
                        case '"': // escaped quote
                            field.push_back('"');
                            state = QuotedField;
                            break;
                        case '\n': // end of row
                            row.push_back(field);
                            // data.push_back(row);


                            // fi=fi+1;
                            // if(fi%10000==0){
                            //     end_time = std::chrono::high_resolution_clock::now();
                            //     // cout<<"file fix  "<<fi/10000<<"  "<<std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count()<<"   "<<row.size()<<"  "<<gbktoutf8 (p->str )<<"    "<<row[10] <<endl;
                            //     cout<<"       sum_row_number "<<main_number<<"  "<<fi/10000<<"   time[s] "<<(std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count())/ 1e6 <<"   row_size "<<row.size()<<"    "<<row[10] <<endl;
                            //     // cout<<row<<endl;
                            //     // cout<<"    "<<row[10]<<endl;
                            // }


                            if(write_in(gbktoutf8(row[10]),str_list)){
                                ;//执行写入
                                data_list.push_back(row);
                                main_number= main_number+1;

                                if(main_number%10000==0){
                                    end_time = std::chrono::high_resolution_clock::now();
                                    // cout<<"清空与整理a "<<main_number<<endl;
                                    cout<<"       sum_row_number "<<main_number<<"  "<<fi/10000<<"   time[s] "<<(std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count())/ 1e6 <<"   row_size "<<row.size()<<"    "<<row[10] <<endl;
                                    // cout<<"清空与整理b "<<main_number<<endl;
                                    // write_csv_file(new_path +"/"+ to_string(csv_i)+".csv",data_list);

                                    lock.lock();  // 手动开启线程锁
                                        now_sum_id_number = now_sum_id_number+1;
                                    lock.unlock();  // 手动关闭线程锁

                                    write_csv_file(new_path +"/"+to_string(now_sum_id_number)+"  "+ to_string(csv_i)+".csv",data_list);
                                    data_list.clear();
                                    csv_i=csv_i+1;
                                }

                            }

                            row.clear();
                            field.clear();
                            state = UnquotedField;
                            break;
                        default: // end of quote
                            row.push_back(field);
                            field.clear();
                            state = UnquotedField;
                            break;
                    }
                    break;
            }
        }
        if (!field.empty()) {
            row.push_back(field);
        }

        if (!row.empty()) {
            fi=fi+1;
            // if(fi%10000==0){
            //     cout<<"fi  "<<fi<<endl;
            // }
            // data.push_back(row);
            end_time = std::chrono::high_resolution_clock::now();
            cout<<"file fix  "<<main_number<<"  "<<fi/10000<<"  "<<std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count()<<"   "<<row.size()<<"  "<<gbktoutf8 (read_file)<<"    "<<row[10] <<endl;
            // cout<<"                  "<<row[10]<<endl;

            if(write_in(gbktoutf8(row[10]),str_list)){
                ;//执行写入
                data_list.push_back(row);

                main_number= main_number+1;
                if(main_number%10000==0){
                    // cout<<"清空与整理c "<<main_number<<endl;
                    // write_csv_file(new_path +"/"+ to_string(csv_i)+".csv",data_list);

                    lock.lock();  // 手动开启线程锁
                        now_sum_id_number = now_sum_id_number+1;
                    lock.unlock();  // 手动关闭线程锁
                    write_csv_file(new_path +"/"+to_string(now_sum_id_number)+"  "+ to_string(csv_i)+".csv",data_list);

                    data_list.clear();
                    csv_i=csv_i+1;
                }
            }
        }



        end_time = std::chrono::high_resolution_clock::now();
        cout<<"       sum_row_number "<<main_number<<"  "<<fi/10000<<"   time[s] "<<(std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count())/ 1e6 <<"   row_size "<<row.size()<<"    "<<row[10] <<endl;
        cout<<"file size  "<<main_number<<"   "<<gbktoutf8(read_file)<<endl;
        file.close();
    // }




    cout<<"main_len "<<data_list.size()<<endl;

    // write_csv_file(new_path +"/"+ to_string(csv_i+1)+".csv",data_list);

    lock.lock();  // 手动开启线程锁
        now_sum_id_number = now_sum_id_number+1;
    lock.unlock();  // 手动关闭线程锁



    write_csv_file(new_path +"/"+to_string(now_sum_id_number)+"  "+ to_string(csv_i)+".csv",data_list);

    return std::move(data_list);


}






int main() {

    // string date_str = "2021-06-29-01"; // 给定的日期字符串

    // // 将日期字符串转换为时间点
    // tm date_tm = {};
    // strptime(date_str.c_str(), "%Y-%m-%d-%H", &date_tm);
    // time_t date_time = mktime(&date_tm);
    // auto date_point = chrono::system_clock::from_time_t(date_time);

    // // 获取当前时间点
    // auto now_point = chrono::system_clock::now();

    // // 判断当前时间是否超过给定时间点
    // if (now_point > date_point) {
    //     cout << "Current time has exceeded the given date." << endl;
    //     exit(0); // 退出程序
    // }


    //记录程序开始的时间是多久

    auto start = std::chrono::high_resolution_clock::now();

    now_sum_id_number=0; // 标记具体的线程中的进度


    // 传递一个文件路径,传递一个二维数组,写入一下。
    // int csv_i=0;
    int csv_i=26;

    // 十万行写入一次,传入一次,少计算数量多次

	system("chcp 65001");
	u_init();
	cout<<"exe path: "<<main_path<<endl;
    vector<vector<string>> data;
	string read_path = main_path+utf8togbk("/读取文件");
	ulist main_list =get_all_file(read_path);
	cout<<main_list.len()<<endl;
	int main_i =0;
	int fi=0;

    string write_path = main_path    +utf8togbk("/写入文件");
    make_file(write_path);

    string   new_path = write_path +utf8togbk("/")+ getCurrentTimeStr();
    make_file(new_path  );


    // 开始读取数据了,等于0 的不要,写一个函数,传递一个值,和一个数组,返回其中的内容。

    vector<string> str_list;

    // str_list.push_back(utf8togbk("买卖合同纠纷"));
    // str_list.push_back("买卖合同纠纷");

    vector<vector<string>> csv_list= read_csv(utf8togbk("查询词.csv"));
    copy_file(utf8togbk("查询词.csv").c_str(),new_path.c_str());
    // cout<<<<endl;

    cout<<"---------------------------------------------------------------------------------------------------------"<<endl;

    int main_number=0;


    int cxi=0;
    string cxd="";
    for(auto & dc:csv_list){

        cxd = gbktoutf8(dc[0]);
        if(cxd!= ""){
            cout<<"查询关键词序列  在其中  "<<cxi<<" :"<<cxd<<endl;
            str_list.push_back(cxd);
        }else{
            cout<<"查询关键词序列 不在其中 "<<cxi<<" :"<<cxd<<endl;
            // str_list.push_back(cxd);
        }

        cxi=cxi+1;
    }



    cout<<"---------------------------------------------------------------------------------------------------------"<<endl;
    int main_len = main_list.len();


       //-------------------------------------------------------------------
    // auto start = std::chrono::high_resolution_clock::now();
    cout<<"cpu_number "<<cpu_number()<<endl;
    int pool_size = cpu_number();
    int task_num = 23;

    ThreadPool threadpool(pool_size);
    vector<future<vector<vector<string>>>> resVec;

    string read_file;
    for (node *p = main_list.head->next; p != main_list.head; p = p->next){
        read_file = p->str;

        resVec.emplace_back(
            // 分为前后两个部分,参数要对的上。
            threadpool.AddTask([fi,main_i,main_len,csv_i,read_file,new_path,main_number,str_list] { return re_vector_2d_list_fuc(fi,main_i,main_len,csv_i,read_file,new_path,main_number,str_list); })
        );
    } 



    int write_file_number = 0;

    vector<vector<vector<string>>> remain_list;
    /*打印每个任务的返回值*/
    for (auto&& result: resVec) {
        remain_list.push_back(result.get());
        // cout <<"data: "<< result.get() << " \n";
    }

    for(auto dd:remain_list){
        // cout<<dd<<endl;
    }
    // 获取结束时间点
    auto end = std::chrono::high_resolution_clock::now();
    // 计算代码执行时间(以毫秒为单位)
    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
    // 输出执行时间
    std::cout << "run time:" << duration << " ms" << std::endl;
    

    cout << endl;

	system("pause");
	return 0;
}


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471
  • 472
  • 473
  • 474
  • 475
  • 476
  • 477
  • 478
  • 479
  • 480
  • 481
  • 482
  • 483
  • 484
  • 485
  • 486
  • 487
  • 488
  • 489
  • 490
  • 491
  • 492
  • 493
  • 494
  • 495
  • 496
  • 497
  • 498
  • 499
  • 500
  • 501
  • 502
  • 503
  • 504
  • 505
  • 506
  • 507
  • 508
  • 509
  • 510
  • 511
  • 512
  • 513
  • 514
  • 515
  • 516
  • 517
  • 518
  • 519
  • 520
  • 521
  • 522
  • 523
  • 524
  • 525
  • 526
  • 527
  • 528
  • 529
  • 530
  • 531
  • 532
  • 533
  • 534
  • 535
  • 536
  • 537
  • 538
  • 539
  • 540
  • 541
  • 542
  • 543
  • 544
  • 545
  • 546
  • 547
  • 548
  • 549
  • 550
  • 551
  • 552
  • 553
  • 554
  • 555
  • 556
  • 557
  • 558
  • 559
  • 560
  • 561
  • 562
  • 563
  • 564
  • 565
  • 566
  • 567
  • 568
  • 569
  • 570
  • 571
  • 572
  • 573
  • 574
  • 575
  • 576
  • 577
  • 578
  • 579
  • 580
  • 581
  • 582
  • 583
  • 584
  • 585
  • 586
  • 587
  • 588
  • 589
  • 590
  • 591
  • 592
  • 593
  • 594
  • 595
  • 596
  • 597
  • 598
  • 599
  • 600
  • 601
  • 602
  • 603
  • 604
  • 605
  • 606
  • 607
  • 608
  • 609
  • 610
  • 611
  • 612
  • 613
  • 614
  • 615
  • 616
  • 617
  • 618
  • 619
  • 620
  • 621
  • 622
  • 623
  • 624
  • 625
  • 626
  • 627
  • 628
  • 629
  • 630
  • 631
  • 632
  • 633
  • 634
  • 635
  • 636
  • 637
  • 638
  • 639
  • 640
  • 641
  • 642
  • 643
  • 644
  • 645
  • 646
  • 647
  • 648
  • 649
  • 650
  • 651
  • 652
  • 653
  • 654
  • 655
  • 656
  • 657
  • 658
  • 659
  • 660
  • 661
  • 662
  • 663
  • 664
  • 665
  • 666
  • 667
  • 668
  • 669
  • 670
  • 671
  • 672
  • 673

c++ 运行效果,用27g大小的部分计算的,非常快 60s不到
在这里插入图片描述

pass 还有一个线程池文件,有需要call,我发你吧。

分析c++的 main.cpp 文件,逻辑是
获取指定文件夹下的所有文件,然后开启线程池计算,不断计算就可以了。

//转载请勿去除我的联系方式

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/550109
推荐阅读
相关标签
  

闽ICP备14008679号