|
|
|
LINQ กับการคำนวณ อักษรตัวเลข ทำงานได้ช้ามากมาก ต้องแก้ไขอย่างไร? |
|
|
|
|
|
|
|
Code
Private Sub TestCallFunction()
For i As Integer = 0 To 5000000
GateNineteenString((i Mod 10).ToString())
Next
End Sub
Public Shared Function GateNineteenString(ByVal s As String) As String()
Dim sMaster() As String = {"00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
"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", "35", "36", "37", "38", "39",
"40", "41", "42", "43", "44", "45", "46", "47", "48", "49",
"50", "51", "52", "53", "54", "55", "56", "57", "58", "59",
"60", "61", "62", "63", "64", "65", "66", "67", "68", "69",
"70", "71", "72", "73", "74", "75", "76", "77", "78", "79",
"80", "81", "82", "83", "84", "85", "86", "87", "88", "89",
"90", "91", "92", "93", "94", "95", "96", "97", "98", "99"
}
Return (From r In sMaster Where r.Any(Function(JimThaiBigSizeMoreHeadOverArray) r.Contains(s))) 'Where r.Contains(s) End Function
[x]
Example : GateNineteenString("5")
Result : 50, 05, 51, 15, 52, 25, 35, 53, 45, 54, 55, 65, 56, 75, 57, 85, 58, 95, 59 (จำนวน 19 ตัว)
Tag : .NET, VB.NET, C#, VS 2010 (.NET 4.x)
|
|
|
|
|
|
Date :
2013-06-10 11:12:37 |
By :
ผ่านมา |
View :
939 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code
Private Sub TestCallFunction()
For i As Integer = 0 To 5000000
GateNineteenString((i Mod 10).ToString())
Next
End Sub
Public Shared Function GateNineteenString(ByVal s As String) As String()
Dim sMaster() As String = {"00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
"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", "35", "36", "37", "38", "39",
"40", "41", "42", "43", "44", "45", "46", "47", "48", "49",
"50", "51", "52", "53", "54", "55", "56", "57", "58", "59",
"60", "61", "62", "63", "64", "65", "66", "67", "68", "69",
"70", "71", "72", "73", "74", "75", "76", "77", "78", "79",
"80", "81", "82", "83", "84", "85", "86", "87", "88", "89",
"90", "91", "92", "93", "94", "95", "96", "97", "98", "99"
}
Return (From r In sMaster Where r.Any(Function(JimThaiBigSizeMoreHeadOverArray) r.Contains(s))) 'Where r.Contains(s)
End Function
[x]
Example : GateNineteenString("5")
Result : 50, 05, 51, 15, 52, 25, 53, 35, 45, 54, 55, 65, 56, 75, 57, 85, 58, 95, 59 (จำนวน 19 ตัว)
|
|
|
|
|
Date :
2013-06-10 11:15:13 |
By :
ผ่านมา |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลำพัง โปรแกรมมิ่ง คงจะช่วยอะไรไม่ได้ (วนลูป = 5000000 ครั้ง และคำนวณ)
เท่าที่นึกได้ตอนนี้ เดี๋ยวลอง เลื่อนบิต (Shift bit) ถ้าโชคดีคงได้คำตอบ
|
|
|
|
|
Date :
2013-06-10 12:05:09 |
By :
ผ่านมา |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#NO2 ผมลองดูแล้ว แต่โชคไม่ดีครับ
คิดใหม่ ปัญหาเดิม (เพื่อหาคำตอบ)
A1 = 1
A1 = 1
A1 = 1
A1 = 1
A1 = 1
A1 = 1
A1 = 1
A1 = 1
A1 จำนวน 8 แถว เหมือนกันทุกระเบียดนิ้ว
มันเหมือนกัน (ดูไปดูมามันเป็นสิ่งเดียวกันด้วยซ้ำไป) แล้วผมจะแยกความแตกต่างของ A1 ได้อย่างไร?
----
|
|
|
|
|
Date :
2013-06-10 12:36:33 |
By :
ผ่านมา |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอโทษทีครับ วันหน้าค่อยว่ากันใหม่
|
|
|
|
|
Date :
2013-06-10 17:18:45 |
By :
ผ่านมา |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|