External polyphase merge sort - poor performanceRacing Java Arrays.sort with NON recursive Merge Sort...

GPLv2 - licensing for commercial use

How do I express some one as a black person?

Good allowance savings plan?

Latest web browser compatible with Windows 98

Rejected in 4th interview round citing insufficient years of experience

How do I deal with a powergamer in a game full of beginners in a school club?

Why does Deadpool say "You're welcome, Canada," after shooting Ryan Reynolds in the end credits?

In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?

Set and print content of environment variable in cmd.exe subshell?

If the Captain's screens are out, does he switch seats with the co-pilot?

Who is eating data? Xargs?

Space in array system equations

Low budget alien movie about the Earth being cooked

Should I take out a loan for a friend to invest on my behalf?

What Happens when Passenger Refuses to Fly Boeing 737 Max?

Aliens englobed the Solar System: will we notice?

PTIJ: How can I halachically kill a vampire?

How to clip a background including nodes according to an arbitrary shape?

Built-In Shelves/Bookcases - IKEA vs Built

Is there an elementary proof that there are infinitely many primes that are *not* completely split in an abelian extension?

Tricky AM-GM inequality

How to create a hard link to an inode (ext4)?

Grey hair or white hair

How can The Temple of Elementary Evil reliably protect itself against kinetic bombardment?



External polyphase merge sort - poor performance


Racing Java Arrays.sort with NON recursive Merge Sort implementationConcurrent task processing queueEfficient Multithreaded File Processessing in JavaFile-based fixed-record merge sortExternal bottom up merge sort too slowParallel integer tree sort algorithm in JavaMemory/performance of merge sort codeParsing shorts from binary file and finding the closest and furthest pointsNode comparison using priority queue for Dijkstra's Shortest Path AlgorithmBottom-up singly linked list merge sort in C++













0












$begingroup$


I have implemented external polyphase merge sort which is useful to sort large files that do not fit into main memory. My implementation uses Priority queue as an internal data structure used to extract the smallest element when needed. For example:



int min_file;
FileRecord fr = queue.poll();
buff_writer.write(fr.getValue());
min_file = fr.getFileIndex(); //used to read from file from where min was taken




The algorithm (see link below) works as expected but it is very slow. The first - distribution phase works just fine without any performance issues. The problem must be somewhere in the second - merge phase. I have already removed/fixed some minor performance issues but the major issue is obviously still present.



More info about the algorithm itself can be found here and my implementation is available here (readme file and sample input file attached as well).



Thank you very much for the code review and suggestions.









share







New contributor




henrich is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$

















    0












    $begingroup$


    I have implemented external polyphase merge sort which is useful to sort large files that do not fit into main memory. My implementation uses Priority queue as an internal data structure used to extract the smallest element when needed. For example:



    int min_file;
    FileRecord fr = queue.poll();
    buff_writer.write(fr.getValue());
    min_file = fr.getFileIndex(); //used to read from file from where min was taken




    The algorithm (see link below) works as expected but it is very slow. The first - distribution phase works just fine without any performance issues. The problem must be somewhere in the second - merge phase. I have already removed/fixed some minor performance issues but the major issue is obviously still present.



    More info about the algorithm itself can be found here and my implementation is available here (readme file and sample input file attached as well).



    Thank you very much for the code review and suggestions.









    share







    New contributor




    henrich is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    $endgroup$















      0












      0








      0





      $begingroup$


      I have implemented external polyphase merge sort which is useful to sort large files that do not fit into main memory. My implementation uses Priority queue as an internal data structure used to extract the smallest element when needed. For example:



      int min_file;
      FileRecord fr = queue.poll();
      buff_writer.write(fr.getValue());
      min_file = fr.getFileIndex(); //used to read from file from where min was taken




      The algorithm (see link below) works as expected but it is very slow. The first - distribution phase works just fine without any performance issues. The problem must be somewhere in the second - merge phase. I have already removed/fixed some minor performance issues but the major issue is obviously still present.



      More info about the algorithm itself can be found here and my implementation is available here (readme file and sample input file attached as well).



      Thank you very much for the code review and suggestions.









      share







      New contributor




      henrich is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.







      $endgroup$




      I have implemented external polyphase merge sort which is useful to sort large files that do not fit into main memory. My implementation uses Priority queue as an internal data structure used to extract the smallest element when needed. For example:



      int min_file;
      FileRecord fr = queue.poll();
      buff_writer.write(fr.getValue());
      min_file = fr.getFileIndex(); //used to read from file from where min was taken




      The algorithm (see link below) works as expected but it is very slow. The first - distribution phase works just fine without any performance issues. The problem must be somewhere in the second - merge phase. I have already removed/fixed some minor performance issues but the major issue is obviously still present.



      More info about the algorithm itself can be found here and my implementation is available here (readme file and sample input file attached as well).



      Thank you very much for the code review and suggestions.







      java mergesort





      share







      New contributor




      henrich is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      henrich is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      henrich is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 6 mins ago









      henrichhenrich

      1




      1




      New contributor




      henrich is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      henrich is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      henrich is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          henrich is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f215295%2fexternal-polyphase-merge-sort-poor-performance%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          henrich is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          henrich is a new contributor. Be nice, and check out our Code of Conduct.













          henrich is a new contributor. Be nice, and check out our Code of Conduct.












          henrich is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f215295%2fexternal-polyphase-merge-sort-poor-performance%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Fairchild Swearingen Metro Inhaltsverzeichnis Geschichte | Innenausstattung | Nutzung | Zwischenfälle...

          Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...

          Marineschifffahrtleitung Inhaltsverzeichnis Geschichte | Heutige Organisation der NATO | Nationale und...