lilydjwg / swapview-rosetta

Print swap usage per process. Implemented in various programming languages
493 stars 108 forks source link

Racket_parallel:improve the performance #177

Closed Antigen-1 closed 2 years ago

Antigen-1 commented 2 years ago

I've experimented many times according to the Racket Reference and it runs slightly faster than the implementations of Racket and Racket_compiled now.

---------Results-------- (Diff): KMinAvg Min Avg Max Stdev Cnt
Racket_parallel (100%): 519.94 512.06 542.92 634.90 32.85 20
Racket (100%): 544.95 526.47 561.27 599.69 20.97 20
Racket_compiled (100%): 547.92 537.09 563.61 587.08 17.57 20

(Tested on Racket 8.4[CS], Ubuntu 20.04)

Antigen-1 commented 2 years ago

Sorry to bother you again,sir. This is my last commit. I'm just a lover of computer programming and a freshman of Racket,for which the performance of my implementation never exceeds largely that of the Racket implementation even if it runs in parallel. Also, I have no idea whether the program will present worse performance or not when the computation it faces increases in that the usage of swap is always 0 on my machine although it is on.

lilydjwg commented 2 years ago

I get an error (it presents before and after this change):

map: all lists must have same size
  first list length: 473
  other list length: 472
  procedure: #<procedure:swapview.rkt:57:27>
  context...:
   /usr/share/racket/collects/racket/private/map.rkt:257:2: gen-map
   body of "/home/lilydjwg/workspace/swapview-rosetta/Racket_parallel/compiled/swapview_rkt.zo"

You can test against the Rss: field to test if you are not using swap.

Antigen-1 commented 2 years ago

I need to use place-channel-put/get to fix the bug, but the cost for communicating with the places can be fairly high.

Antigen-1 commented 2 years ago
---------Results-------- (Diff): KMinAvg Min Avg Max Stdev Cnt
Racket_parallel (100%): 689.73 680.27 700.79 725.76 13.70 20
Racket_compiled (100%): 696.66 685.11 704.51 727.93 10.45 20
Racket (100%): 697.58 690.65 704.46 735.48 10.36 20

I find myself having a poor understanding of the place-channel.