I have written sorting script using external sort and here is the code. Currently this is being used to sort large file size of nearly 5GB and time taken to complete the sorting is 32 minutes on windows 64 bit(64 bit active perl ) 12GB RAM.Wanted to know if the performance can be increased/improved or is this with good performance? Does my code needs any modification? I have also attached sample data to sort. Please help.

input lines: 2012/12/13 @ 13:32:35,585 @ ,, INFO [EJB3Deployer] Starting java:comp + multiplexer 2012/12/13 @ 13:32:34,585 @ ,, INFO [EJB3Deployer] Starting java:comp + multiplexer 2012/12/13 @ 12:32:35,485 @ ,, INFO [EJB3Deployer] Starting java:comp + multiplexer 2012/12/13 @ 13:35:35,585 @ ,, INFO [EJB3Deployer] Starting java:comp + multiplexer 2012/12/13 @ 14:32:35,585 @ ,, INFO [EJB3Deployer] Starting java:comp + multiplexer 2012/12/15 @ 13:32:35,612 @ ,, INFO [EJB3Deployer] Starting java:comp + multiplexer 2012/12/12 @ 11:32:35,585 @ ,, INFO [EJB3Deployer] Starting java:comp + multiplexer 2012/10/13 @ 13:32:45,735 @ ,, INFO [EJB3Deployer] Starting java:comp + multiplexer $\ = "\n" ; $, = "\t" ; use strict; use warnings; use Sort::External; print "Script start time is\n ", scalar localtime(); open DATA, "sort_input.txt"; open OUTPUT, ">>sort_output.txt"; my $sortscheme = sub { my @flds_a = split(/,,/, $Sort::External::a); my @flds_b = split(/,,/, $Sort::External::b); $flds_a[0] cmp $flds_b[0]; }; #my $temp_directory = '/home/david/temp'; my $sortex = Sort::External->new( mem_threshold => 1024**2 * 16, sortsub => $sortscheme, #working_dir => $temp_directory, ); while (<DATA>) { chomp; $sortex->feed($_);} $sortex->finish; while ( defined( $_ = $sortex->fetch ) ) { print OUTPUT $_; } close DATA; close OUTPUT; print "Script end time is\n ", scalar localtime();

In reply to external sort performance improved? by rkshyam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.