Author Topic: Testing Parallel Linq  (Read 7047 times)

0 Members and 1 Guest are viewing this topic.

TheMaster

  • Guest
Testing Parallel Linq
« on: August 29, 2012, 12:05:03 PM »
After spending some time trying to figure out how to leverage PLINQ in projects running on AutoCAD 2012 or later, while minimizing source code incompatibility with earlier releases, I came up with what I think is a good strategy (see the attached file).

I'm also interested in what kind of results others are seeing in the informal testing I've done, which is attached. My results show 2-3x faster execution under PLINQ. Anyone that would like to try this, or also add some additional test cases, is free to do so, provided you post your results back here, along with system specs.

Code - Text: [Select]
  1. =====================================================================
  2. Data size: 25000, iterations: 10
  3. ---------------------------------------------------------------------
  4. Sort on Z-ordinate (parallel):                       0.0750
  5. Sort on Z-ordinate (sequential):                     0.1160
  6.  
  7. Sort by distance from bp (parallel):                 0.0870
  8. Sort by distance from bp (sequential):               0.1250
  9.  
  10. Distance from bp to nearest point (parallel):        0.0020
  11. Distance from bp to nearest point (sequential):      0.0200
  12.  
  13. Find point furthest from bp (parallel):              0.0150
  14. Find point furthest from bp (sequential):            0.0300
  15. Find point furthest from bp (sequential, no linq):   0.0100
  16.  
  17. =====================================================================
  18. Data size: 50000, iterations: 10
  19. ---------------------------------------------------------------------
  20. Sort on Z-ordinate (parallel):                       0.1910
  21. Sort on Z-ordinate (sequential):                     0.2140
  22.  
  23. Sort by distance from bp (parallel):                 0.0960
  24. Sort by distance from bp (sequential):               0.2550
  25.  
  26. Distance from bp to nearest point (parallel):        0.0170
  27. Distance from bp to nearest point (sequential):      0.0450
  28.  
  29. Find point furthest from bp (parallel):              0.0570
  30. Find point furthest from bp (sequential):            0.0590
  31. Find point furthest from bp (sequential, no linq):   0.0340
  32.  
  33. =====================================================================
  34. Data size: 100000, iterations: 10
  35. ---------------------------------------------------------------------
  36. Sort on Z-ordinate (parallel):                       0.2730
  37. Sort on Z-ordinate (sequential):                     0.5060
  38.  
  39. Sort by distance from bp (parallel):                 0.3300
  40. Sort by distance from bp (sequential):               0.5900
  41.  
  42. Distance from bp to nearest point (parallel):        0.0290
  43. Distance from bp to nearest point (sequential):      0.0980
  44.  
  45. Find point furthest from bp (parallel):              0.0410
  46. Find point furthest from bp (sequential):            0.1120
  47. Find point furthest from bp (sequential, no linq):   0.0720
  48.  
  49. =====================================================================
  50. Data size: 200000, iterations: 10
  51. ---------------------------------------------------------------------
  52. Sort on Z-ordinate (parallel):                       0.5220
  53. Sort on Z-ordinate (sequential):                     1.1560
  54.  
  55. Sort by distance from bp (parallel):                 0.5900
  56. Sort by distance from bp (sequential):               1.2210
  57.  
  58. Distance from bp to nearest point (parallel):        0.0440
  59. Distance from bp to nearest point (sequential):      0.1850
  60.  
  61. Find point furthest from bp (parallel):              0.0810
  62. Find point furthest from bp (sequential):            0.2180
  63. Find point furthest from bp (sequential, no linq):   0.1550
  64.  
  65. =====================================================================
  66. Data size: 400000, iterations: 10
  67. ---------------------------------------------------------------------
  68. Sort on Z-ordinate (parallel):                       1.1510
  69. Sort on Z-ordinate (sequential):                     2.4260
  70.  
  71. Sort by distance from bp (parallel):                 1.0830
  72. Sort by distance from bp (sequential):               2.7010
  73.  
  74. Distance from bp to nearest point (parallel):        0.0980
  75. Distance from bp to nearest point (sequential):      0.3750
  76.  
  77. Find point furthest from bp (parallel):              0.1550
  78. Find point furthest from bp (sequential):            0.4290
  79. Find point furthest from bp (sequential, no linq):   0.3000
  80.  
  81. =====================================================================
  82. Data size: 800000, iterations: 10
  83. ---------------------------------------------------------------------
  84. Sort on Z-ordinate (parallel):                       2.4290
  85. Sort on Z-ordinate (sequential):                     5.2400
  86.  
  87. Sort by distance from bp (parallel):                 2.1450
  88. Sort by distance from bp (sequential):               5.7810
  89.  
  90. Distance from bp to nearest point (parallel):        0.2000
  91. Distance from bp to nearest point (sequential):      0.8460
  92.  
  93. Find point furthest from bp (parallel):              0.3240
  94. Find point furthest from bp (sequential):            0.8620
  95. Find point furthest from bp (sequential, no linq):   0.6050
  96. --------------------------------------------------------------
  97.  

edit:kdub code=txt
« Last Edit: August 29, 2012, 03:39:12 PM by Kerry »

Draftek

  • Guest
Re: Testing Parallel Linq
« Reply #1 on: August 29, 2012, 12:25:57 PM »
That is impressive!
Thanks, I'll be checking out your code in the next few days.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Testing Parallel Linq
« Reply #2 on: August 29, 2012, 01:24:06 PM »
Sweet!
 
Ran with a decent amount of files(.pdfs,.dwg, etc....) open and some other fairly expensive programs open.
 
Code: [Select]
------------------
System Information
------------------
Time of this report: 8/29/2012, 12:20:05
       Machine name: OWNER-PC
   Operating System: Windows 7 Professional 64-bit (6.1, Build 7601) Service Pack 1 (7601.win7sp1_gdr.120503-2030)
           Language: English (Regional Setting: English)
System Manufacturer: INTEL_
       System Model: DX58SO__
               BIOS: Default System BIOS
          Processor: Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz (8 CPUs), ~2.8GHz
             Memory: 8192MB RAM
Available OS Memory: 8180MB RAM
          Page File: 5015MB used, 11344MB available
        Windows Dir: C:\Windows
    DirectX Version: DirectX 11
DX Setup Parameters: Not found
   User DPI Setting: Using System DPI
 System DPI Setting: 96 DPI (100 percent)
    DWM DPI Scaling: Disabled
     DxDiag Version: 6.01.7601.17514 64bit Unicode

 
...................................................
 
 
Code - Text: [Select]
  1.  
  2. =====================================================================
  3. Data size: 50000, iterations: 10
  4. ---------------------------------------------------------------------
  5. Sort on Z-ordinate (parallel):                       0.1240
  6. Sort on Z-ordinate (sequential):                     0.3300
  7. Sort by distance from bp (parallel):                 0.1610
  8. Sort by distance from bp (sequential):               0.2870
  9. Distance from bp to nearest point (parallel):        0.0150
  10. Distance from bp to nearest point (sequential):      0.0400
  11. Find point furthest from bp (parallel):              0.0720
  12. Find point furthest from bp (sequential):            0.0750
  13. Find point furthest from bp (sequential, no linq):   0.0300
  14. =====================================================================
  15. Data size: 100000, iterations: 10
  16. ---------------------------------------------------------------------
  17. Sort on Z-ordinate (parallel):                       0.3780
  18. Sort on Z-ordinate (sequential):                     0.4740
  19. Sort by distance from bp (parallel):                 0.2400
  20. Sort by distance from bp (sequential):               0.6760
  21. Distance from bp to nearest point (parallel):        0.0330
  22. Distance from bp to nearest point (sequential):      0.0800
  23. Find point furthest from bp (parallel):              0.0950
  24. Find point furthest from bp (sequential):            0.1410
  25. Find point furthest from bp (sequential, no linq):   0.0720
  26. =====================================================================
  27. Data size: 200000, iterations: 10
  28. ---------------------------------------------------------------------
  29. Sort on Z-ordinate (parallel):                       0.5140
  30. Sort on Z-ordinate (sequential):                     1.1120
  31. Sort by distance from bp (parallel):                 0.6810
  32. Sort by distance from bp (sequential):               1.2120
  33. Distance from bp to nearest point (parallel):        0.0710
  34. Distance from bp to nearest point (sequential):      0.1660
  35. Find point furthest from bp (parallel):              0.2170
  36. Find point furthest from bp (sequential):            0.3600
  37. Find point furthest from bp (sequential, no linq):   0.1520
  38. =====================================================================
  39. Data size: 400000, iterations: 10
  40. ---------------------------------------------------------------------
  41. Sort on Z-ordinate (parallel):                       1.5210
  42. Sort on Z-ordinate (sequential):                     2.1980
  43. Sort by distance from bp (parallel):                 0.9840
  44. Sort by distance from bp (sequential):               2.5050
  45. Distance from bp to nearest point (parallel):        0.1410
  46. Distance from bp to nearest point (sequential):      0.3390
  47. Find point furthest from bp (parallel):              0.5660
  48. Find point furthest from bp (sequential):            0.6820
  49. Find point furthest from bp (sequential, no linq):   0.3100
  50. =====================================================================
  51. Data size: 800000, iterations: 10
  52. ---------------------------------------------------------------------
  53. Sort on Z-ordinate (parallel):                       2.4990
  54. Sort on Z-ordinate (sequential):                     4.9120
  55. Sort by distance from bp (parallel):                 2.8990
  56. Sort by distance from bp (sequential):               5.5620
  57. Distance from bp to nearest point (parallel):        0.2640
  58. Distance from bp to nearest point (sequential):      0.6860
  59. Find point furthest from bp (parallel):              0.3730
  60. Find point furthest from bp (sequential):            0.9980
  61. Find point furthest from bp (sequential, no linq):   0.6300
  62. =====================================================================
  63. Data size: 1600000, iterations: 10
  64. ---------------------------------------------------------------------
  65. Sort on Z-ordinate (parallel):                        5.4650
  66. Sort on Z-ordinate (sequential):                     10.8710
  67. Sort by distance from bp (parallel):                  4.9620
  68. Sort by distance from bp (sequential):               12.0740
  69. Distance from bp to nearest point (parallel):         0.5370
  70. Distance from bp to nearest point (sequential):       1.3810
  71. Find point furthest from bp (parallel):               0.9580
  72. Find point furthest from bp (sequential):             1.9890
  73. Find point furthest from bp (sequential, no linq):    1.2640
  74. ---------------------------------------------------------------------
  75.  


edit:kdub code=txt
« Last Edit: August 29, 2012, 03:38:35 PM by Kerry »

TheMaster

  • Guest
Re: Testing Parallel Linq
« Reply #3 on: August 29, 2012, 02:49:38 PM »
Thanks Jeff.  Those results seem very consistent with what I was getting.
I'm going to try the tests on a dual-core machine to see what that's like.

Sweet!
 
Ran with a decent amount of files(.pdfs,.dwg, etc....) open and some other fairly expensive programs open.
 
Code: [Select]
------------------
System Information
------------------
Time of this report: 8/29/2012, 12:20:05
       Machine name: OWNER-PC
   Operating System: Windows 7 Professional 64-bit (6.1, Build 7601) Service Pack 1 (7601.win7sp1_gdr.120503-2030)
           Language: English (Regional Setting: English)
System Manufacturer: INTEL_
       System Model: DX58SO__
               BIOS: Default System BIOS
          Processor: Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz (8 CPUs), ~2.8GHz
             Memory: 8192MB RAM
Available OS Memory: 8180MB RAM
          Page File: 5015MB used, 11344MB available
        Windows Dir: C:\Windows
    DirectX Version: DirectX 11
DX Setup Parameters: Not found
   User DPI Setting: Using System DPI
 System DPI Setting: 96 DPI (100 percent)
    DWM DPI Scaling: Disabled
     DxDiag Version: 6.01.7601.17514 64bit Unicode

 
...................................................
 
 
Code: [Select]

=====================================================================
Data size: 50000, iterations: 10
---------------------------------------------------------------------
Sort on Z-ordinate (parallel):                       0.1240
Sort on Z-ordinate (sequential):                     0.3300
Sort by distance from bp (parallel):                 0.1610
Sort by distance from bp (sequential):               0.2870
Distance from bp to nearest point (parallel):        0.0150
Distance from bp to nearest point (sequential):      0.0400
Find point furthest from bp (parallel):              0.0720
Find point furthest from bp (sequential):            0.0750
Find point furthest from bp (sequential, no linq):   0.0300
=====================================================================
Data size: 100000, iterations: 10
---------------------------------------------------------------------
Sort on Z-ordinate (parallel):                       0.3780
Sort on Z-ordinate (sequential):                     0.4740
Sort by distance from bp (parallel):                 0.2400
Sort by distance from bp (sequential):               0.6760
Distance from bp to nearest point (parallel):        0.0330
Distance from bp to nearest point (sequential):      0.0800
Find point furthest from bp (parallel):              0.0950
Find point furthest from bp (sequential):            0.1410
Find point furthest from bp (sequential, no linq):   0.0720
=====================================================================
Data size: 200000, iterations: 10
---------------------------------------------------------------------
Sort on Z-ordinate (parallel):                       0.5140
Sort on Z-ordinate (sequential):                     1.1120
Sort by distance from bp (parallel):                 0.6810
Sort by distance from bp (sequential):               1.2120
Distance from bp to nearest point (parallel):        0.0710
Distance from bp to nearest point (sequential):      0.1660
Find point furthest from bp (parallel):              0.2170
Find point furthest from bp (sequential):            0.3600
Find point furthest from bp (sequential, no linq):   0.1520
=====================================================================
Data size: 400000, iterations: 10
---------------------------------------------------------------------
Sort on Z-ordinate (parallel):                       1.5210
Sort on Z-ordinate (sequential):                     2.1980
Sort by distance from bp (parallel):                 0.9840
Sort by distance from bp (sequential):               2.5050
Distance from bp to nearest point (parallel):        0.1410
Distance from bp to nearest point (sequential):      0.3390
Find point furthest from bp (parallel):              0.5660
Find point furthest from bp (sequential):            0.6820
Find point furthest from bp (sequential, no linq):   0.3100
=====================================================================
Data size: 800000, iterations: 10
---------------------------------------------------------------------
Sort on Z-ordinate (parallel):                       2.4990
Sort on Z-ordinate (sequential):                     4.9120
Sort by distance from bp (parallel):                 2.8990
Sort by distance from bp (sequential):               5.5620
Distance from bp to nearest point (parallel):        0.2640
Distance from bp to nearest point (sequential):      0.6860
Find point furthest from bp (parallel):              0.3730
Find point furthest from bp (sequential):            0.9980
Find point furthest from bp (sequential, no linq):   0.6300
=====================================================================
Data size: 1600000, iterations: 10
---------------------------------------------------------------------
Sort on Z-ordinate (parallel):                        5.4650
Sort on Z-ordinate (sequential):                     10.8710
Sort by distance from bp (parallel):                  4.9620
Sort by distance from bp (sequential):               12.0740
Distance from bp to nearest point (parallel):         0.5370
Distance from bp to nearest point (sequential):       1.3810
Find point furthest from bp (parallel):               0.9580
Find point furthest from bp (sequential):             1.9890
Find point furthest from bp (sequential, no linq):    1.2640
---------------------------------------------------------------------

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Testing Parallel Linq
« Reply #4 on: August 29, 2012, 03:35:45 PM »
Excellent learner Tony, Thanks.

Exported to file from System Information
Quote
System Information report written at: 08/30/12 05:33:04
System Name: KDUB-04
[System Summary]

Item   Value   
OS Name   Microsoft Windows 7 Ultimate   
Version   6.1.7601 Service Pack 1 Build 7601   
Other OS Description    Not Available   
OS Manufacturer   Microsoft Corporation   
System Name   KDUB-04   
System Manufacturer   System manufacturer   
System Model   System Product Name   
System Type   x64-based PC   
Processor   Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s)   
BIOS Version/Date   American Megatrends Inc. 1502, 2011/03/02   
SMBIOS Version   2.6   
Windows Directory   C:\Windows   
System Directory   C:\Windows\system32   
Boot Device   \Device\HarddiskVolume1   
Locale   Australia   
Hardware Abstraction Layer   Version = "6.1.7601.17514"   
User Name   KDUB-04\Kdub04   
Time Zone   E. Australia Standard Time   
Installed Physical Memory (RAM)   16.0 GB   
Total Physical Memory   16.0 GB   
Available Physical Memory   11.6 GB   
Total Virtual Memory   32.0 GB   
Available Virtual Memory   26.9 GB   
Page File Space   16.0 GB   
Page File   C:\pagefile.sys   

Results
Code - Text: [Select]
  1. =====================================================================
  2. Data size: 25000, iterations: 10
  3. ---------------------------------------------------------------------
  4. Sort on Z-ordinate (parallel):                       0.0510
  5. Sort on Z-ordinate (sequential):                     0.1090
  6.  
  7. Sort by distance from bp (parallel):                 0.0440
  8. Sort by distance from bp (sequential):               0.0950
  9.  
  10. Distance from bp to nearest point (parallel):        0.0020
  11. Distance from bp to nearest point (sequential):      0.0100
  12.  
  13. Find point furthest from bp (parallel):              0.0090
  14. Find point furthest from bp (sequential):            0.0130
  15. Find point furthest from bp (sequential, no linq):   0.0100
  16.  
  17. =====================================================================
  18. Data size: 50000, iterations: 10
  19. ---------------------------------------------------------------------
  20. Sort on Z-ordinate (parallel):                       0.1290
  21. Sort on Z-ordinate (sequential):                     0.1880
  22.  
  23. Sort by distance from bp (parallel):                 0.0990
  24. Sort by distance from bp (sequential):               0.2120
  25.  
  26. Distance from bp to nearest point (parallel):        0.0050
  27. Distance from bp to nearest point (sequential):      0.0200
  28.  
  29. Find point furthest from bp (parallel):              0.0480
  30. Find point furthest from bp (sequential):            0.0410
  31. Find point furthest from bp (sequential, no linq):   0.0200
  32.  
  33. =====================================================================
  34. Data size: 100000, iterations: 10
  35. ---------------------------------------------------------------------
  36. Sort on Z-ordinate (parallel):                       0.2750
  37. Sort on Z-ordinate (sequential):                     0.3460
  38.  
  39. Sort by distance from bp (parallel):                 0.2500
  40. Sort by distance from bp (sequential):               0.3910
  41.  
  42. Distance from bp to nearest point (parallel):        0.0140
  43. Distance from bp to nearest point (sequential):      0.0500
  44.  
  45. Find point furthest from bp (parallel):              0.0760
  46. Find point furthest from bp (sequential):            0.0810
  47. Find point furthest from bp (sequential, no linq):   0.0400
  48.  
  49. =====================================================================
  50. Data size: 200000, iterations: 10
  51. ---------------------------------------------------------------------
  52. Sort on Z-ordinate (parallel):                       0.5010
  53. Sort on Z-ordinate (sequential):                     0.7780
  54.  
  55. Sort by distance from bp (parallel):                 0.5730
  56. Sort by distance from bp (sequential):               0.8700
  57.  
  58. Distance from bp to nearest point (parallel):        0.0340
  59. Distance from bp to nearest point (sequential):      0.1080
  60.  
  61. Find point furthest from bp (parallel):              0.0640
  62. Find point furthest from bp (sequential):            0.1370
  63. Find point furthest from bp (sequential, no linq):   0.0900
  64.  
  65. =====================================================================
  66. Data size: 400000, iterations: 10
  67. ---------------------------------------------------------------------
  68. Sort on Z-ordinate (parallel):                       0.9420
  69. Sort on Z-ordinate (sequential):                     1.6000
  70.  
  71. Sort by distance from bp (parallel):                 0.9580
  72. Sort by distance from bp (sequential):               1.8310
  73.  
  74. Distance from bp to nearest point (parallel):        0.0730
  75. Distance from bp to nearest point (sequential):      0.2280
  76.  
  77. Find point furthest from bp (parallel):              0.1700
  78. Find point furthest from bp (sequential):            0.2730
  79. Find point furthest from bp (sequential, no linq):   0.1890
  80.  
  81. =====================================================================
  82. Data size: 800000, iterations: 10
  83. ---------------------------------------------------------------------
  84. Sort on Z-ordinate (parallel):                       1.6600
  85. Sort on Z-ordinate (sequential):                     3.7130
  86.  
  87. Sort by distance from bp (parallel):                 1.6110
  88. Sort by distance from bp (sequential):               4.0590
  89.  
  90. Distance from bp to nearest point (parallel):        0.1230
  91. Distance from bp to nearest point (sequential):      0.4460
  92.  
  93. Find point furthest from bp (parallel):              0.2210
  94. Find point furthest from bp (sequential):            0.5550
  95. Find point furthest from bp (sequential, no linq):   0.3790
  96. ---------------------------------------------------------------------
  97.  
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

BlackBox

  • King Gator
  • Posts: 3770
Re: Testing Parallel Linq
« Reply #5 on: August 29, 2012, 03:46:32 PM »
System:

Quote
[System Summary]

Item   Value   
OS Name   Microsoft Windows 7 Enterprise   
Version   6.1.7601 Service Pack 1 Build 7601   
Other OS Description    Not Available   
OS Manufacturer   Microsoft Corporation   
System Name   RenderMan   
System Manufacturer   Dell Inc.   
System Model   Precision M6600   
System Type   x64-based PC   
Processor   Intel(R) Core(TM) i7-2820QM CPU @ 2.30GHz, 2301 Mhz, 4 Core(s), 8 Logical Processor(s)   
BIOS Version/Date   Dell Inc. A03, 5/24/2011   
SMBIOS Version   2.6   
Windows Directory   C:\WINDOWS   
System Directory   C:\WINDOWS\system32   
Boot Device   \Device\HarddiskVolume1   
Locale   United States   
Hardware Abstraction Layer   Version = "6.1.7601.17514"   
User Name   Foo\RenderMan
Time Zone   Eastern Daylight Time   
Installed Physical Memory (RAM)   16.0 GB   
Total Physical Memory   16.0 GB   
Available Physical Memory   8.07 GB   
Total Virtual Memory   47.7 GB   
Available Virtual Memory   39.5 GB   
Page File Space   31.8 GB   
Page File   C:\pagefile.sys   




Results:

Code - Text: [Select]
  1. =====================================================================
  2. Data size: 25000, iterations: 10
  3. ---------------------------------------------------------------------
  4. Sort on Z-ordinate (parallel):                       0.0780
  5. Sort on Z-ordinate (sequential):                     0.0890
  6.  
  7. Sort by distance from bp (parallel):                 0.0580
  8. Sort by distance from bp (sequential):               0.1490
  9.  
  10. Distance from bp to nearest point (parallel):        0.0040
  11. Distance from bp to nearest point (sequential):      0.0110
  12.  
  13. Find point furthest from bp (parallel):              0.0250
  14. Find point furthest from bp (sequential):            0.0370
  15. Find point furthest from bp (sequential, no linq):   0.0100
  16.  
  17. =====================================================================
  18. Data size: 50000, iterations: 10
  19. ---------------------------------------------------------------------
  20. Sort on Z-ordinate (parallel):                       0.3710
  21. Sort on Z-ordinate (sequential):                     0.1820
  22.  
  23. Sort by distance from bp (parallel):                 0.1180
  24. Sort by distance from bp (sequential):               0.3380
  25.  
  26. Distance from bp to nearest point (parallel):        0.0110
  27. Distance from bp to nearest point (sequential):      0.0300
  28.  
  29. Find point furthest from bp (parallel):              0.0710
  30. Find point furthest from bp (sequential):            0.0700
  31. Find point furthest from bp (sequential, no linq):   0.0440
  32.  
  33. =====================================================================
  34. Data size: 100000, iterations: 10
  35. ---------------------------------------------------------------------
  36. Sort on Z-ordinate (parallel):                       0.2970
  37. Sort on Z-ordinate (sequential):                     0.5320
  38.  
  39. Sort by distance from bp (parallel):                 0.4380
  40. Sort by distance from bp (sequential):               0.6160
  41.  
  42. Distance from bp to nearest point (parallel):        0.0350
  43. Distance from bp to nearest point (sequential):      0.0700
  44.  
  45. Find point furthest from bp (parallel):              0.0790
  46. Find point furthest from bp (sequential):            0.1440
  47. Find point furthest from bp (sequential, no linq):   0.0600
  48.  
  49. =====================================================================
  50. Data size: 200000, iterations: 10
  51. ---------------------------------------------------------------------
  52. Sort on Z-ordinate (parallel):                       0.4880
  53. Sort on Z-ordinate (sequential):                     0.9530
  54.  
  55. Sort by distance from bp (parallel):                 0.4810
  56. Sort by distance from bp (sequential):               1.1690
  57.  
  58. Distance from bp to nearest point (parallel):        0.0530
  59. Distance from bp to nearest point (sequential):      0.1420
  60.  
  61. Find point furthest from bp (parallel):              0.2310
  62. Find point furthest from bp (sequential):            0.2930
  63. Find point furthest from bp (sequential, no linq):   0.1300
  64.  
  65. =====================================================================
  66. Data size: 400000, iterations: 10
  67. ---------------------------------------------------------------------
  68. Sort on Z-ordinate (parallel):                       0.9930
  69. Sort on Z-ordinate (sequential):                     2.2240
  70.  
  71. Sort by distance from bp (parallel):                 1.4090
  72. Sort by distance from bp (sequential):               2.3240
  73.  
  74. Distance from bp to nearest point (parallel):        0.0950
  75. Distance from bp to nearest point (sequential):      0.3280
  76.  
  77. Find point furthest from bp (parallel):              0.2230
  78. Find point furthest from bp (sequential):            0.4660
  79. Find point furthest from bp (sequential, no linq):   0.2790
  80.  
  81. =====================================================================
  82. Data size: 800000, iterations: 10
  83. ---------------------------------------------------------------------
  84. Sort on Z-ordinate (parallel):                       2.3550
  85. Sort on Z-ordinate (sequential):                     4.3410
  86.  
  87. Sort by distance from bp (parallel):                 3.0350
  88. Sort by distance from bp (sequential):               4.7440
  89.  
  90. Distance from bp to nearest point (parallel):        0.2000
  91. Distance from bp to nearest point (sequential):      0.6040
  92.  
  93. Find point furthest from bp (parallel):              0.3530
  94. Find point furthest from bp (sequential):            0.9140
  95. Find point furthest from bp (sequential, no linq):   0.5510
  96. ---------------------------------------------------------------------
  97.  

edit:kdub code=txt
« Last Edit: August 29, 2012, 04:14:50 PM by Kerry »
"How we think determines what we do, and what we do determines what we get."

TheMaster

  • Guest
Re: Testing Parallel Linq
« Reply #6 on: August 29, 2012, 09:34:11 PM »
Kerry & RenderMan, thanks for posting.

Very interesting results if I may say so.


Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: Testing Parallel Linq
« Reply #7 on: August 29, 2012, 10:56:47 PM »

Quote
OS Name   Microsoft Windows 7 Professional   
Version   6.1.7601 Service Pack 1 Build 7601   
Other OS Description    Not Available   
OS Manufacturer   Microsoft Corporation   
System Name   JEFFM-SAGER   
System Manufacturer   CLEVO CO.   
System Model   X7200   
System Type   x64-based PC   
Processor   Intel(R) Core(TM) i7 CPU         960  @ 3.20GHz, 3193 Mhz, 4 Core(s), 8 Logical Processor(s)   
BIOS Version/Date   Phoenix Technologies LTD 6.00, 6/21/2011   
SMBIOS Version   2.6   
Windows Directory   C:\Windows   
System Directory   C:\Windows\system32   
Boot Device   \Device\HarddiskVolume1   
Locale   United States   
Hardware Abstraction Layer   Version = "6.1.7601.17514"   
User Name   jeffm-Sager\Jeff-i7   
Time Zone   Pacific Daylight Time   
Installed Physical Memory (RAM)   12.0 GB   
Total Physical Memory   12.0 GB   
Available Physical Memory   6.67 GB   
Total Virtual Memory   38.1 GB   
Available Virtual Memory   31.0 GB   
Page File Space   26.1 GB   
Page File   C:\pagefile.sys   

Code - Text: [Select]
  1. Starting data size (doubled on each iteration) <25000.0000>:
  2.  
  3. Iterations <6>:
  4.  
  5. Working (do not use input devices while test is running)....
  6. All times in seconds,
  7.  
  8.  
  9. =====================================================================
  10. Data size: 25000, iterations: 10
  11. ---------------------------------------------------------------------
  12. Sort on Z-ordinate (parallel):                       0.1060
  13. Sort on Z-ordinate (sequential):                     0.0880
  14.  
  15. Sort by distance from bp (parallel):                 0.0640
  16. Sort by distance from bp (sequential):               0.1500
  17.  
  18. Distance from bp to nearest point (parallel):        0.0000
  19. Distance from bp to nearest point (sequential):      0.0100
  20.  
  21. Find point furthest from bp (parallel):              0.0260
  22. Find point furthest from bp (sequential):            0.0260
  23. Find point furthest from bp (sequential, no linq):   0.0200
  24.  
  25. =====================================================================
  26. Data size: 50000, iterations: 10
  27. ---------------------------------------------------------------------
  28. Sort on Z-ordinate (parallel):                       0.2440
  29. Sort on Z-ordinate (sequential):                     0.2960
  30.  
  31. Sort by distance from bp (parallel):                 0.1340
  32. Sort by distance from bp (sequential):               0.2430
  33.  
  34. Distance from bp to nearest point (parallel):        0.0100
  35. Distance from bp to nearest point (sequential):      0.0300
  36.  
  37. Find point furthest from bp (parallel):              0.0530
  38. Find point furthest from bp (sequential):            0.0710
  39. Find point furthest from bp (sequential, no linq):   0.0300
  40.  
  41. =====================================================================
  42. Data size: 100000, iterations: 10
  43. ---------------------------------------------------------------------
  44. Sort on Z-ordinate (parallel):                       0.2190
  45. Sort on Z-ordinate (sequential):                     0.4510
  46.  
  47. Sort by distance from bp (parallel):                 0.2590
  48. Sort by distance from bp (sequential):               0.6370
  49.  
  50. Distance from bp to nearest point (parallel):        0.0220
  51. Distance from bp to nearest point (sequential):      0.0950
  52.  
  53. Find point furthest from bp (parallel):              0.1250
  54. Find point furthest from bp (sequential):            0.1320
  55. Find point furthest from bp (sequential, no linq):   0.0700
  56.  
  57. =====================================================================
  58. Data size: 200000, iterations: 10
  59. ---------------------------------------------------------------------
  60. Sort on Z-ordinate (parallel):                       0.5590
  61. Sort on Z-ordinate (sequential):                     1.0910
  62.  
  63. Sort by distance from bp (parallel):                 0.4390
  64. Sort by distance from bp (sequential):               1.2250
  65.  
  66. Distance from bp to nearest point (parallel):        0.0520
  67. Distance from bp to nearest point (sequential):      0.1420
  68.  
  69. Find point furthest from bp (parallel):              0.2100
  70. Find point furthest from bp (sequential):            0.3150
  71. Find point furthest from bp (sequential, no linq):   0.1390
  72.  
  73. =====================================================================
  74. Data size: 400000, iterations: 10
  75. ---------------------------------------------------------------------
  76. Sort on Z-ordinate (parallel):                       1.6490
  77. Sort on Z-ordinate (sequential):                     2.0270
  78.  
  79. Sort by distance from bp (parallel):                 0.8690
  80. Sort by distance from bp (sequential):               2.2600
  81.  
  82. Distance from bp to nearest point (parallel):        0.1130
  83. Distance from bp to nearest point (sequential):      0.2940
  84.  
  85. Find point furthest from bp (parallel):              0.6280
  86. Find point furthest from bp (sequential):            0.6700
  87. Find point furthest from bp (sequential, no linq):   0.2920
  88.  
  89. =====================================================================
  90. Data size: 800000, iterations: 10
  91. ---------------------------------------------------------------------
  92. Sort on Z-ordinate (parallel):                       2.5790
  93. Sort on Z-ordinate (sequential):                     4.6060
  94.  
  95. Sort by distance from bp (parallel):                 2.8200
  96. Sort by distance from bp (sequential):               5.1220
  97.  
  98. Distance from bp to nearest point (parallel):        0.2080
  99. Distance from bp to nearest point (sequential):      0.6470
  100.  
  101. Find point furthest from bp (parallel):              0.4210
  102. Find point furthest from bp (sequential):            0.9120
  103. Find point furthest from bp (sequential, no linq):   0.5660
  104. ---------------------------------------------------------------------
  105.  

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Testing Parallel Linq
« Reply #8 on: August 29, 2012, 11:46:31 PM »

=====================================================================
Data size: 25000, iterations: 10
---------------------------------------------------------------------
Sort on Z-ordinate (parallel):                       0.1060
Sort on Z-ordinate (sequential):                     0.0880

Sort by distance from bp (parallel):                 0.0640
Sort by distance from bp (sequential):               0.1500

Distance from bp to nearest point (parallel):        0.0000
Distance from bp to nearest point (sequential):      0.0100


Next step would be to calculate it 0.00005(-0.00005) seconds before you start to calculate it.
 

TheMaster

  • Guest
Re: Testing Parallel Linq
« Reply #9 on: August 30, 2012, 12:06:28 AM »

=====================================================================
Data size: 25000, iterations: 10
---------------------------------------------------------------------
Sort on Z-ordinate (parallel):                       0.1060
Sort on Z-ordinate (sequential):                     0.0880

Sort by distance from bp (parallel):                 0.0640
Sort by distance from bp (sequential):               0.1500

Distance from bp to nearest point (parallel):        0.0000
Distance from bp to nearest point (sequential):      0.0100


Next step would be to calculate it 0.00005(-0.00005) seconds before you start to calculate it.

That's why I have it prompt for the test parameters. If the numbers are too small at the low end, you can start with a larger data set, and/or more iterations. The time is the total for all (10 in this case) iterations, so you could just increase that as well, but then of course the result wouldn't be comparable to those that use the defaults.

TheMaster

  • Guest
Re: Testing Parallel Linq
« Reply #10 on: August 30, 2012, 12:23:52 PM »
Added 3 additional tests for calculating extents (using 3 different methods), and a few minor revisions here and there. 
« Last Edit: August 30, 2012, 12:45:41 PM by TT »

Andrey Bushman

  • Swamp Rat
  • Posts: 864
Re: Testing Parallel Linq
« Reply #11 on: August 31, 2012, 06:51:09 AM »
If it be interesting for you, then I can to compile it and to test in the Windows 8 x64 and AutoCAD 2013 x64 (today in the evening).

TheMaster

  • Guest
Re: Testing Parallel Linq
« Reply #12 on: August 31, 2012, 10:50:49 AM »
Added 3 additional tests for calculating extents (using 3 different methods), and a few minor revisions here and there.

Found some bugs  :roll:, I'll post a revised copy in a day or so.

kaefer

  • Guest
Re: Testing Parallel Linq
« Reply #13 on: August 31, 2012, 12:01:42 PM »
Found some bugs  :roll:,

Code - C#: [Select]
  1. double f = ( max - min ) + min;

Edit: No bug-report, but a support question... How to determine the data structure's size at which parallelization consistently outperforms the customary single-threaded approach?

- at design time, e.g. hard and fast rules of thumb, profiling
- at compile time, e.g. automatic parallelization
- at runtime
« Last Edit: August 31, 2012, 02:19:36 PM by kaefer »

TheMaster

  • Guest
Re: Testing Parallel Linq
« Reply #14 on: August 31, 2012, 05:42:56 PM »
Quote
On a side note, the Extents class in that last update (which has some bugs I've since fixed), outperforms the Autodesk.AutoCAD.DatabaseServices.Extents3d class with the exact same code, by at least 100%.  IOW, it's at least twice as fast, with or without parallel execution

I'm sorry, did I say "twice as fast" ? 

It looks like it's actually closer to 3x faster.
« Last Edit: August 31, 2012, 11:55:05 PM by TT »

TheMaster

  • Guest
Re: Testing Parallel Linq
« Reply #15 on: August 31, 2012, 05:46:02 PM »
Added 3 additional tests for calculating extents (using 3 different methods), and a few minor revisions here and there.

Found some bugs  :roll:, I'll post a revised copy in a day or so.

Fixed more bugs, and included a very fast managed version of Extents3d.


TheMaster

  • Guest
Re: Testing Parallel Linq
« Reply #16 on: August 31, 2012, 10:55:13 PM »
Found some bugs  :roll:,
Code - C#: [Select]
  1. double f = ( max - min ) + min;

Not sure what I was thinking there, but it was merely supposed to do what this does:

Code - C#: [Select]
  1.    static IEnumerable<Point3d> GetRandomPoints( int count )
  2.    {
  3.       Random r = new Random();
  4.       for( int i = 0; i < count; i++ )
  5.       {
  6.          yield return new Point3d( r.NextDouble(), r.NextDouble(), r.NextDouble())
  7.             .ScaleBy( 10000, Point3d.Origin );
  8.       }
  9.    }
  10.