Multithreaded is slower than singlethreaded : <p>It is not faster - it's also much slower .</p>

<p>I have cpu with 4 core.</p>

<p>==================================================================</p>

<pre><code>Private Sub btn_Singelthreaded_Click(sender As Object, e As EventArgs) Handles btn_Singelthreaded.Click

    Dim Num As Long
    Dim sw As New Stopwatch
    Dim TimeAvrg As Double
    For i = 0 To 8

        Num = 0
        sw.Restart()
        Do Until Num &gt; 500000000 '500,000,000
            Num += 1
        Loop


        TimeAvrg += sw.Elapsed.TotalSeconds
        'sw.Stop()
    Next
    Console.WriteLine($"[Singelthreaded] Avrg Time: {TimeAvrg / 8}{Environment.NewLine}")


End Sub

Private NumThrd As Long
Private swThrd As New Stopwatch
Private Sub btn_Multithreaded_Click(sender As Object, e As EventArgs) Handles btn_Multithreaded.Click


    Dim T1 As New Threading.Thread(AddressOf ForLoop) : T1.Start()
    Dim T2 As New Threading.Thread(AddressOf ForLoop) : T2.Start()
    Dim T3 As New Threading.Thread(AddressOf ForLoop) : T3.Start()

End Sub


Private Sub ForLoop()
    Dim TimeAvrg As Double
    For i = 0 To 2
        TimeAvrg = 0
        NumThrd = 0
        swThrd.Start()
        Do Until NumThrd &gt; '500,000,000
            NumThrd += 1
        Loop
        TimeAvrg += swThrd.Elapsed.TotalSeconds
        'swThrd.Stop()

    Next
    Console.WriteLine($"[Multithreaded] Avrg Time: {TimeAvrg / 3}{Environment.NewLine}")
End Sub
</code></pre>

<p>Result:
[Singelthreaded] Avrg Time: 2.1183545</p>

<p>[Multithreaded] Avrg Time: 11.6677879333333</p>
