Sponsored Content
Top Forums Programming Improve the performance of my C++ code Post 302931794 by yifangt on Thursday 15th of January 2015 01:34:20 PM
Old 01-15-2015
Improve the performance of my C++ code

Hello,
Attached is my very simple C++ code to remove any substrings (DNA sequence) of each other, i.e. any redundant sequence is removed to get unique sequences. Similar to sort | uniq command except there is reverse-complementary for DNA sequence. The program runs well with small dataset, but when I increase the data size to ~1,000 entries (some maybe 100,000bp long), it took about 2 hours to finish.
My question is: How to improve the performance of my code?
It seems memory issue can be excluded as 256GB RAM is available.
1) What are the room for coding techniques based on my current algorithms, which is a simple "sorting---looping---comparing" with complexity n^2 ?
2) What are the better algorithms, for sure there are many?

Either of the two questions is too complicate for myself, but I am wondering if anybody can give me some help to increase the performance of the program. Thanks a lot!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

improve performance by using ls better than find

Hi , i'm searching for files over many Aix servers with rsh command using this request : find /dir1 -name '*.' -exec ls {} \; and then count them with "wc" but i would improve this search because it's too long and replace directly find with ls command but "ls *. " doesn't work. and... (3 Replies)
Discussion started by: Nicol
3 Replies

2. Shell Programming and Scripting

How to improve grep performance...

Hi All, I am using grep command to find string "abc" in one file . content of file is *********** abc = xyz def= lmn ************ i have given the below mentioned command to redirect the output to tmp file grep abc file | sort -u | awk '{print #3}' > out_file Then i am searching... (2 Replies)
Discussion started by: pooga17
2 Replies

3. UNIX for Dummies Questions & Answers

Improve Performance

hi someone tell me which ways i can improve disk I/O and system process performance.kindly refer some commands so i can do it on my test machine.thanks, Mazhar (2 Replies)
Discussion started by: mazhar99
2 Replies

4. Shell Programming and Scripting

Any way to improve performance of this script

I have a data file of 2 gig I need to do all these, but its taking hours, any where i can improve performance, thanks a lot #!/usr/bin/ksh echo TIMESTAMP="$(date +'_%y-%m-%d.%H-%M-%S')" function showHelp { cat << EOF >&2 syntax extreme.sh FILENAME Specify filename to parse EOF... (3 Replies)
Discussion started by: sirababu
3 Replies

5. Shell Programming and Scripting

Improve the performance of a shell script

Hi Friends, I wrote the below shell script to generate a report on alert messages recieved on a day. But i for processing around 4500 lines (alerts) the script is taking aorund 30 minutes to process. Please help me to make it faster and improve the performace of the script. i would be very... (10 Replies)
Discussion started by: apsprabhu
10 Replies

6. Shell Programming and Scripting

Want to improve the performance of script

Hi All, I have written a script as follows which is taking lot of time in executing/searching only 3500 records taken as input from one file in log file of 12 GB Approximately. Working of script is read the csv file as an input having 2 arguments which are transaction_id,mobile_number and search... (6 Replies)
Discussion started by: poweroflinux
6 Replies

7. Shell Programming and Scripting

How to improve the performance of parsers in Perl?

Hi, I have around one lakh records. I have used XML for the creation of the data. I have used these 2 Perl modules. use XML::DOM; use XML::LibXML; The data will loo like this and most it is textual entries. <eid>19000</eid> <einfo>This is the ..........</einfo> ......... (3 Replies)
Discussion started by: vanitham
3 Replies

8. Programming

Help with improve the performance of grep

Input file: #content_1 12314345345 242467 #content_14 436677645 576577657 #content_100 3425546 56 #content_12 243254546 1232454 . . Reference file: content_100 (1 Reply)
Discussion started by: cpp_beginner
1 Replies

9. Shell Programming and Scripting

Improve performance of echo |awk

Hi, I have a script which looks like this. Input file data1^20 data2^30 #!/bin/sh file"/home/Test.txt" while read line do echo $line |awk 'BEGIN { FS = "^" } ; { print $2 }' echo $line |awk 'BEGIN { FS = "^" } ; { print $1 }' | gzip | wc -c done <"$file" How can i... (4 Replies)
Discussion started by: chetan.c
4 Replies

10. UNIX for Dummies Questions & Answers

How to improve the performance of this script?

Hi , i wrote a script to convert dates to the formate i want .it works fine but the conversion is tkaing lot of time . Can some one help me tweek this script #!/bin/bash file=$1 ofile=$2 cp $file $ofile mydates=$(grep -Po '+/+/+' $ofile) # gets 8/1/13 mydates=$(echo "$mydates" | sort |... (5 Replies)
Discussion started by: vikatakavi
5 Replies
mark(1) 						      General Commands Manual							   mark(1)

NAME
mark - mark messages (only available within the message handling system, mh) SYNOPSIS
mark [+folder] [msgs] [options] OPTIONS
Adds messages to sequences. The mark command takes the messages specified by the msgs argument, and adds them to the sequence named by using the -sequence name option. If no msgs argument is given, the current message is added to the sequence. This option can also be used in conjunction with the -zero option. This option cannot be used in conjunction with the -delete or -list options. If you attempt to use two or more of these options together, mark takes the last occurrence of any of them, and ignores any previous occurrences. Deletes messages from sequences. The mark command removes the messages specified by the msgs argument from the named sequences. As with -add, the sequences are specified using the -sequence name option. If no msgs argument is given, the current message is removed from the named sequences. This option can also be used in conjunction with the -zero option. This option cannot be used in conjunction with the -add or -list options. If you attempt to use two or more of these options together, mark takes the last occurrence of any of them, and ignores any previous occurrences. Prints a list of the valid options to this command. Lists the sequences defined for the current folder and the messages associated with those sequences. If you wish to list only particular sequences in a folder, you can specify them by using the -sequence name option. If you do not use this option, mark lists all the sequences in the current folder. You can also list sequences in another folder by using the +folder argu- ment. This option cannot be used in conjunction with the -add or -delete options. If you attempt to use two or more of these options together, mark takes the last occurrence of any of them, and ignores any previous occurrences. The mark command automatically lists the sequences in the folder unless you use the -add or -delete options, or unless you give a msgs argument. Indicates that the sequence being created should be made readable for other MH users. When you use the -add option to create a sequence, the -public option makes the sequence public, that is, readable to other MH users. By contrast, the -nopublic option indicates that the sequence should be private, or exclusive to your own MH environment. Specifies the sequence(s) you wish to list or modify. You use this option in conjunction with the -add, -delete, and -list options, to name the sequences you wish to add messages to, delete messages from, or list. You can name more than one sequence by listing the names with a space separating them; you do not need to repeat -sequence before each sequence name. Modifies the behavior of the -add and -delete options. If you use the -zero option with -add, all messages are removed from the named sequence before the new messages are added to it. This means that the sequence contains only the new messages that you have just added. The -nozero option simply adds the new mes- sages to the existing sequence, without deleting any of the messages already in the sequence. This is the default behavior. If you use -zero with -delete, all of the messages in the folder are added to the named sequence, and then the messages you specify are deleted from the sequence. This means that the sequence contains all the messages in the folder except those that you have named. The -nozero option simply removes the messages you specify from the sequence, leaving the rest of the contents of the sequence intact. This is the default behavior. The defaults for this command are: +folder defaults to the current folder msgs defaults to the current message (or all messages if -list is specified) -add if a msgs argument is specified, -list otherwise -nopublic if the folder is read-only, -public otherwise -nozero DESCRIPTION
Use the mark command to assign a name to a sequence of messages within the current folder. A sequence is a number of messages that are grouped together under a name. You can then use that name with any MH command instead of a mes- sage number, to perform the command on all the messages in the sequence. You can still continue to handle messages individually when they belong to a sequence, just as you did before. Sequences are specific to a particular folder. You can use the same name for sequences in different folders without causing problems. By default, mark operates on the sequences in the current folder. You can specify another folder by using the +folder argument. When you create a sequence using mark, the ordering of messages within the folder remains unchanged. So if messages 3, 7 and 9 are put into the sequence, they are still numbered as messages 3, 7 and 9 when you use scan to list the contents of the folder. The scan command does not show you what sequences messages belong to; you must use mark to find this information. The mark command is used only to modify sequences, not messages. If you delete a message from a sequence using mark, it remains in the folder. However, when a message is deleted or moved from a folder (for example, using rmm(1) or refile(1)), it is removed from all the sequences in that folder. RESTRICTIONS
MH allows a maximum of ten sequences in any folder. The names of sequences must consist entirely of alphabetic or numeric characters, and must begin with an alphabetic character. Punctuation is not allowed. In addition, certain names are reserved for use by MH. These include first, next, prev, and cur. PROFILE COMPONENTS
Path: To determine your Mail directory EXAMPLES
The first example shows how mark lists all the sequences in a named folder: % mark cur: 20 Admail: 1 5 9-12 test: 3-7 This output is identical to that produced by using the -list option. The next example creates a sequence called odd, containing the first five odd-numbered messages: % mark -add -sequence odd 1 3 5 7 9% mark cur: 20 Admail: 1 5 9-12 odd: 1 3 5 7 9 test: 3-7 The next example deletes message 3 from the sequences test and odd: % mark -delete -sequence test odd 3% mark cur: 20 Admail: 1 5 9-12 odd: 1 5 7 9 test: 4-7 The final example illustrates how the -zero option works with -add. All messages are first removed from the sequence test, and then messages 1 to 3 are added. The result is that test contains only messages 1 to 3: % mark -add -zero -sequence test 1-3 % mark cur: 20 Admail: 1 5 9-12 odd: 1 5 7 9 test: 1-3 FILES
The user profile. SEE ALSO
folder(1), pick(1), sortm(1) mark(1)
All times are GMT -4. The time now is 07:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy