| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 350 人关注过本帖
标题:VB 处理大CSV文件速度问题
取消只看楼主 加入收藏
yuhaibo2004
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-10-18
收藏
 问题点数:0 回复次数:0 
VB 处理大CSV文件速度问题
     各位大神请帮忙看一下如何提高大CSV文件(12M/共90000多行)的处理速度,谢谢,看了一下
     打开文件用了2s
     分割文本用了5s
     另外在picturebox画4个点阵图用了6s
     
打开文件
Open csv_path For Input As #1
    Do While Not EOF(1)
    Line Input #1, line_data
    ReDim Preserve sline_data(i)
    sline_data(i) = line_data
    i = i + 1
    Loop
    Close #1分割文本
sline_split_data = Split(sline_data(i + 1), ",")
    If sline_split_data(5) = "VF1" And sline_split_data(16) = "IR" And sline_split_data(17) = "LOP1" And sline_split_data(21) = "WLD1" Then
        For j = i + 2 To UBound(sline_data)
            sline_split_data = Split(sline_data(j), ",")
            If UBound(sline_split_data) = 54 Then
                ReDim Preserve X(k)
                ReDim Preserve Y(k)
                ReDim Preserve IV(k)
                ReDim Preserve WD(k)
                ReDim Preserve VF(k)
                ReDim Preserve IR(k)
                X(k) = Val(sline_split_data(53))
                Y(k) = Val(sline_split_data(54))
                IV(k) = Val(sline_split_data(17))
                WD(k) = Val(sline_split_data(21))
                VF(k) = Val(sline_split_data(5))
                IR(k) = Val(sline_split_data(16))
               
                If k > 0 Then
                    If Abs(X(k) - X(k - 1)) > 0 And Abs(X(k) - X(k - 1)) <= x_min Then
                        x_min = Abs(X(k) - X(k - 1))
                    End If
                    If Abs(Y(k) - Y(k - 1)) > 0 And Abs(Y(k) - Y(k - 1)) <= y_min Then
                        y_min = Abs(Y(k) - Y(k - 1))
                    End If
                End If
               
               
                If X(k) >= xmax Then
                    xmax = X(k)
                End If
               
                If X(k) <= xmin Then
                    xmin = X(k)
                End If
               
                If Y(k) >= ymax Then
                    ymax = Y(k)
                End If
               
                If Y(k) <= ymax Then
                    ymin = Y(k)
                End If
                k = k + 1
            End If
        Next
    End If
搜索更多相关主题的帖子: 如何 
2013-11-22 16:57
快速回复:VB 处理大CSV文件速度问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016125 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved