- 日時: 2011/04/05 13:17
- 名前: 花ちゃん
- ***********************************************************************************
* カテゴリー:[文字列処理][アルゴリズム][基本コード] * * キーワード:ファイル入出力,,,,, * ***********************************************************************************
---------------------------------------------------------------------- Re: 文字列連結の高速化 - とうきちろう 2004/06/10-19:33 No.9221 ----------------------------------------------------------------------
前:113.77秒 後:3.30秒 約34.48倍
環境:Win2000 VB6
Const MAX_VALUE = 100000 Const END_OF_LOOP = (MAX_VALUE / 5&) - 1&
Const ADD_VALUE = 55555 Const INITIAL_VALUE = 12345&
Private Sub Command1_Click() Dim tm As Long Dim data As String tm = Timer data = func MsgBox Timer - tm End Sub
Private Function func() Dim i As Long
Dim sCurrStr As String Dim lCurrVal As Long
Dim lLoop As Long
lCurrVal = INITIAL_VALUE
For lLoop = 1 To END_OF_LOOP sCurrStr = sCurrStr & CStr(lCurrVal) lCurrVal = lCurrVal + ADD_VALUE Next
func = sCurrStr End Function
|