I've written up the fasta and knucleotide benchmarks. The knucleotide takes 25 seconds, but since their benchmark says it's given an argument of 2,500,000 and none of the programs use argv, and they all read from stdin, I'm assuming the 2,500,00 is for the fasta benchmark and it's output file. But now that I've got it working, I'm going to work more specifically on optimizing it. This brings me to a request, a sort opcode. The method I think would be best would be similar to perl's `sort {$a <=> $b} @array` syntax. I tried Data::Sort, but it sorts by string and in the reverse of what I needed, so had to copy, paste, and edit it to get it working right. The coding method that I'm imagining would be like this.

.sub main :main
        .local pmc array
        array = new .FixedPMCArray
        array = 3
        .local pmc tmp
        tmp = new .String
        tmp = "zero"
        array[0] = tmp
        tmp = new .String
        tmp = "one"
        array[1] = tmp
        tmp = new .String
        tmp = "two"
        array[2] = tmp
        sort sortsub, array
        $P0 = array[0] # one
        print $P0
        print "\n"
        $S0 = array[1] # two
        print $P0
        print "\n"
        $S0 = array[2] # zero
        print $P0
        print "\n"
.end

.sub sortsub
        .param pmc a
        .param pmc b
        cmp $I0, a, b
        .return($I0)
.end

Using pmcs would allow things such as sorting arrays of arrays.

Hopefully I can get knucleotide optimized in other ways... But it's working.

Reply via email to