Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    5,052
    My Mood
    Cool
    Quote Originally Posted by Deadeys View Post
    I already gave you one. But the reason why the single threaded is a lot slower:

    1 Thread:
    msg = 1 ms
    sleep = 50 ms
    msg = 1 ms
    sleep = 50 ms
    msg = 1 ms
    sleep = 50 ms
    msg = 1 ms
    sleep = 50 ms

    2 threads:
    msg-msg = 2 ms
    sleep-sleep = 50ms
    msg-msg = 2 ms
    sleep-sleep = 50ms

    As you can see, multi thread sleeps at the same time, single thread needs to do all the sleeps after each other. This meens that the sleep is the cause of the difference.

    __

    Test under heavy load (Phenom II x4):

    If you redo the test without sleep (tickcount):
    Code:
    Output 0
    Output 1
    Output 2
    Output 3
    Output 4
    Output 5
    Output 6
    Output 7
    Output 8
    Output 9
    Output 10
    Output 11
    Output 12
    Output 13
    Output 14
    Output 15
    Output 16
    Output 17
    Output 18
    Output 19
    Output 20
    Output 21
    Output 22
    Output 23
    Output 24
    Output 25
    Output 26
    Output 27
    Output 28
    Output 29
    Output 30
    Output 31
    Output 32
    Output 33
    Output 34
    Output 35
    Output 36
    Output 37
    Output 38
    Output 39
    Output 40
    Output 41
    Output 42
    Output 43
    Output 44
    Output 45
    Output 46
    Output 47
    Output 48
    Output 49
    Time normal : 31
    Code:
    Output 38
    Output 13
    Output 0
    Output 26
    Output 39
    Output 44
    Output 14
    Output 1
    Output 27
    Output 45
    Output 40
    Output 15
    Output 2
    Output 28
    Output 41
    Output 46
    Output 16
    Output 3
    Output 29
    Output 42
    Output 47
    Output 17
    Output 30
    Output 4
    Output 43
    Output 48
    Output 18
    Output 31
    Output 5
    Output 49
    Output 19
    Output 32
    Output 6
    Output 20
    Output 33
    Output 7
    Output 10
    Output 21
    Output 11
    Output 8
    Output 34
    Output 22
    Output 9
    Output 35
    Output 12
    Output 23
    Output 37
    Output 36
    Output 25
    Output 24
    Time multi : 125
    As I said, the sleep was the problem, this is with a good time function:

    Code:
    Output 0
    Output 1
    Output 2
    Output 3
    Output 4
    Output 5
    Output 6
    Output 7
    Output 8
    Output 9
    Output 10
    Output 11
    Output 12
    Output 13
    Output 14
    Output 15
    Output 16
    Output 17
    Output 18
    Output 19
    Output 20
    Output 21
    Output 22
    Output 23
    Output 24
    Output 25
    Output 26
    Output 27
    Output 28
    Output 29
    Output 30
    Output 31
    Output 32
    Output 33
    Output 34
    Output 35
    Output 36
    Output 37
    Output 38
    Output 39
    Output 40
    Output 41
    Output 42
    Output 43
    Output 44
    Output 45
    Output 46
    Output 47
    Output 48
    Output 49
    Normal: 0.0128041
    Code:
    Output 38
    Output 13
    Output 0
    Output 26
    Output 39
    Output 44
    Output 14
    Output 1
    Output 27
    Output 40
    Output 45
    Output 15
    Output 2
    Output 28
    Output 46
    Output 41
    Output 16
    Output 3
    Output 29
    Output 42
    Output 47
    Output 4
    Output 17
    Output 30
    Output 43
    Output 48
    Output 18
    Output 5
    Output 31
    Output 49
    Output 19
    Output 6
    Output 32
    Output 20
    Output 7
    Output 10
    Output 33
    Output 11
    Output 8
    Output 21
    Output 34
    Output 22
    Output 9
    Output 12
    Output 35
    Output 23
    Output 37
    Output 36
    Output 24
    Output 25
    Multi: 0.122748
    Also useless... 50 runs is not much..

    Lets do 5k runs, and use cls to clean the screen so we can see the output.
    Code:
    Normal: 0.401239
    Multi: 10.9652
    This is better..

    Lets do 50k runs:
    Code:
    Normal: 3.16472
    Multi: 109.457

    50k, make 2 threads max with multi threading:

    Code:
    Normal: 3.2298
    Multi: 3.12841
    A littel bit better

    Now with 4:
    Code:
    Normal: 3.20476
    Multi: 3.41695
    Hmm, that sucks...

    ___

    Without a heavy game that takes multiple threads:

    50k
    Code:
    Normal: 3.8366
    Multi: 3.384
    5k
    Code:
    Normal: 0.427616
    Multi: 0.335064

    I guess you know enought now :P.
    Please present the source for ur result so others can test.
    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

  2. #17
    Deadeys's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    61
    Reputation
    16
    Thanks
    27
    Quote Originally Posted by topblast View Post


    Please present the source for ur result so others can test.

    I just replaced the tickcount code with the code I posted...

Page 2 of 2 FirstFirst 12

Similar Threads

  1. [Discussion] dragon sea gpk bypass and multi client v54
    By Ashley Dominique in forum Dragon Nest Discussions
    Replies: 2
    Last Post: 02-14-2012, 01:06 PM
  2. [Release] (AnimeArts) Injector and Multi Tool
    By AnimeArts in forum Combat Arms Spammers, Injectors and Multi Tools
    Replies: 11
    Last Post: 06-03-2011, 10:43 AM
  3. Join Rogue Unique, we will take on clans like Lifeline Trio and FGT.
    By kevinedler in forum CrossFire Clan Recruitment & Advertising
    Replies: 1
    Last Post: 01-09-2010, 05:04 PM
  4. *UNPATCHED* MULTI-Hack Aimbot and MUCH MORE :D
    By crazyxxjr in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 2
    Last Post: 08-11-2009, 07:35 AM
  5. How to take advantage of buffer over-flows.
    By radnomguywfq3 in forum Programming Tutorials
    Replies: 1
    Last Post: 01-11-2009, 06:43 PM