掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
VB.NETの演算速度がVB6よりも遅いのを解決するには? (ID:117371)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
VB6で Private Declare Function timeGetTime Lib "winmm.dll" () As Long Private Sub Command1_Click() Dim n As Long Dim a As Double Dim b As Double Dim c As Double Dim t As Long t = timeGetTime a = 1234567890 b = 1234567 For n = 1 To 10000000 c = a * b Next Text1.Text = c & "時間=" & (timeGetTime - t) End Sub VB.NETで Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click Dim n As Integer Dim a As Double Dim b As Double Dim c As Double Dim t As Integer t = timeGetTime a = 1234567890 b = 1234567 For n = 1 To 10000000 c = a * b Next Text1.Text = c & "時間=" & (timeGetTime - t) End Sub ともに最適化しています 処理時間は VB.NET----32mSec VB6-------62mSec でした Doubleの単純計算ではVB.NETの方が倍のスピードです。 たぶんVB6からのアップグレードウィザードを使われていると思いますが、 ループカウンターの設定が数値ではなくObjectになっていませんか? VB6で型宣言が無いとアップグレードウィザードでObject型に変換されます。 Dim n As Objectの様に。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.