分散関数呼び出し
Posted feedbacks - VB.net
.NET Remoting です。既にC#で出てますね。 CPU: Athlon 64 X2 5600+ メモリ: 4GB 同一マシン内で14秒ぐらいです。
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 | ' Remote Object
Public Class RemoteClass
Inherits MarshalByRefObject
Public Function PriceString(ByVal value As Integer, ByVal saving As Integer) As String
Return String.Format("販売価格 {0}円 (定価{1}円から{2}%引き)", (value * (100 - saving) / 100).ToString("N0"), value.ToString("N0"), saving)
End Function
End Class
' Server
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Module ServerModule
Sub Main()
ChannelServices.RegisterChannel(New Http.HttpChannel(8088), False)
RemotingServices.Marshal(New RemoteClass, "Price")
Console.ReadLine()
End Sub
End Module
' Client
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Module ClientModule
Sub Main()
ChannelServices.RegisterChannel(New Http.HttpChannel, False)
Dim t As DateTime = Now
For i As Integer = 1 To 10000
CType(Activator.GetObject(GetType(RemoteClass), "http://localhost:8088/Price"), RemoteClass).PriceString(2000, 20)
Next
Console.WriteLine(Now.Subtract(t).TotalMilliseconds)
End Sub
End Module
|


沢渡 みかげ
#3401()
Rating0/0=0.00
[ reply ]