|
私の環境でテスト
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim line As String = "" '行テキスト
Dim al As New ArrayList '配列
Dim count As Long = 0 '行数
Const CSVPath = "D:\Visual Studio 2022\CSVConvTest\test.csv"
' 経過時間計測
Dim sw As New System.Diagnostics.Stopwatch()
sw.Start()
Using sr As StreamReader = New StreamReader(CSVPath, Encoding.GetEncoding("Shift_JIS"))
line = sr.ReadLine()
Do Until line Is Nothing
al.Add(CSng(line))
line = sr.ReadLine()
count += 1
Loop
End Using
' 経過時間計測
sw.Stop()
'経過時間を出力する
Console.WriteLine("{0}msec {1}count", sw.ElapsedMilliseconds, count)
End Sub
191msec 100000count
218msec 100000count
186msec 100000count
190msec 100000count
186msec 100000count
195msec 100000count
193msec 100000count
203msec 100000count
191msec 100000count
177msec 100000count
そんな遅くないんだけれども...
|