Reducing time complexcity in java

I have developed one application which recursively iterates through all Documents version in parent node (DOM) .
and lists report in outfile .
For each version found i am creating one collection object and at end itrating all objects , outputting it to file .
     // Create Doc iterator
         while (allDocfinish) {
                   check for version of each Doc
                     while (All Version Finishes) {
                             // Read version collect File information .
                            // Add information to Collection (Each object is Java Bean )
      // Iterator Collection Obj
         // OutPut it to CSV I am currently following this format . but this is taking too much time . It is not throwing any Out Of Memory exception
But it is running for more than 20 hours to get all node information (near abt 150 nodes each having 50 - 70 versions in it )
Please suggest solution how do i optimize this
Thanks
Amit

ejp wrote:
That's only 10,500 operations.It's not many. You can't reduce the time complexity of M*N if you have to visit them all. You can loop to 10,500 in much less than a second. So I'd suggest your problems lie elsewhere, most probably in String concatenation when you should be using a StringBuffer or StringBuilder.I am reading whole file version each time to calculate file size . (Putting this in string Buffer Using StringWriter for this )
Even if there is string operation , for each iteration same string references are assigned with new object .

Similar Messages

  • Long time to start Java Web Client (Analyzer 6.2.1)??

    Does anyone know why Analyzer(6.2.1) takes a long time to start Java Web Client. Sometime it's even take more than 5 minutes. I think it is the Java Plug-in starting on the client computer. Any solution?

    The key to Analyzer 6.2.1 running correctly is the version of Sun Java Plugin. The ideal version (most optimal) is 1.3.0_02.Secondary to this if Analyzer performs OK once you are logged in then it could be down to the speed of your connection. The applet compiles at runtime (unlike Analyzer 5 which was a one time download). The delay in getting to the login screen could be this download.Hope this helps.Paul ArmitageAnalitica Ltd.www.analitica.co.uk

  • How can i reduce time of execution

    Hi all,
        I have a report program having HR logical database (PNP). This report were developed 1 year back. which is running well. This program were designed that it should take 1.20 hour execution  time. But since one week it is taking 3 hours. So i need to find why it is taking this much of time. I didn't get any clue to find out. please guide me how i can solve this issue.
       Right answer will be appriciated. Thanking you

    Hai,
    To reduce time of execution go for runtime analysis.
    I think this documentation will help you out...
    RUNTIME ANALYSIS
    The runtime analysis is an additional development workbench tool that is quite useful for analyzing performance of an ABAP / 4 Program or transaction. With this tool, the system can display information about:
    •     Executed instruction
    •     Accessed execution time.
    •     Tables and Types of access.
    •     Chronological execution flow
    The runtime analysis tool creates lists that reveal expensive statements, summarize table accesses. Runtime analysis is specifically designed for tuning individual programs and transactions.
    The Runtime Analysis tool measures ABAP/4 statements that are potentially expensive in terms of CPU time. The most significant of these are:
    Statement used for database access like select.
    Statement used for modularization such as module, perform, call function.
    Internal table statements like append, collect.
    Starting Runtime Analysis
    •     From ABAP/4 development workbench select Test – Runtime Analysis.
    •     From ABAP/4 editor, select utilities – more utilities – Runtime Analysis.
    •     From ABAP/ source code screen, select Execute – Runtime Analysis.
    •     From R3 screen, select System – Utilities – Runtime Analysis.
    •     Entering Transaction code SE30 in the command field.
    Following screen is the initial screen for SE30 transaction.
    On the initial screen, select the needed object you want to analyze i.e. program or transaction. Enter the name of the object. Click on execute. The system will execute the specified object and will generate a trace file or performance data file, which can then be analyzed when the transaction or program is finished.
    Analyzing a performance data file
    These files are created at operating system level and many times occupy large memory space, so be sure to remove the files, which are no longer needed.
    To analyze the files:
    •     Click on Analysis
    •     Following screen is displayed
    •     From GOTO option you can get overview of runtime analysis.
    The options are as follows:
    •     Hit List – Displays a list with the most system expensive instructions.
    •     Tables – Displays the most important tables, the number of accesses and the time needed for the accesses.
    •     Group hit list – Displays a list with the performed instructions classified by instruction type.
    •     Call hierarchy – Presents a chronological listing with the flow of calls during the execution of a program.
    During Runtime Analysis, the system measures the statements and stores these measurements in a performance data file. If you measure the same program or transaction several times, the data can vary. Many factors make it difficult to reproduce identical result. E.g., Network traffic.
    When you evaluate this file, the system displays the overview - Runtime Analysis Evaluation screen including a bar chart for total execution time. From this screen, you can analyze several types of information like:
    •     Hit list: displays the list with the most `system-expensive’ instructions.
    •     Tables: displays the most important tables, the number of accesses and the time needed for the accesses.
    •     Group hit list: displays a list of performed instruction classified by its type.
    •     Call hierarchy: presents a chronological listing with the flow of calls during the execution of program.

  • Calculate elapse time of a Java thread  before execution

    Hi,
    I would like to enquire how can I calculate the elapse time of a Java thread BEFORE this thread is executiing or running.?
    I wish to estimate the elapsed time of each Java thread before execution to better schedule these threads to run on multiple processors for load balancing testing.
    Please help
    -meileng-[                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    You can grab the system time in the initiating thread immediately before calling start(), and as the first step in run() in the new thread.
    However, this measurement is utterly meaningless, as it can vary between architectures or even between consecutive runs on the same box. Furthermore, even once a thread starts, it may do nothing more than that one grab-the-system-time instruction before it get swapped out for a theoretically unbounded amount of time.
    By definition, if you spawn multiple threads in Java, you don't know or care which one get CPU time when, except as you control by syncing, sleep, wait, notify, notifyAll, and whatever control priorities give you. Additionally, you don't know when the OS will give your VM cycles, and on multi-CPU machines, you don't know how many CPUs it will get when it does get cycles.

  • Web Report - ABAP Vs JAVA engine - ABAP 10 times faster than JAVA

    Guys,
    I want to share what we found in our project and see if any of you have insights
    into our findings.We are on NW2004S SP14 and we are moving to SP15 in a couple of weeks.We created query, developed WAD for it and executing the WAD takes for this query takes 22 secs (Vs 2 secs using ABAP) the query output has 1 million records and most of the actions we take from that point on like right click on account takes 20 secs (Vs 0 secs/instant using ABAP) , drilldown to level 4 of account hierarchy takes 58 secs (Vs 5 secs using ABAP), drilldown on cost center level 6 takes 42 secs (Vs 4 secs using ABAP), , right click on cost center takes 32 secs (Vs 3 secs using ABAP), ..etc.
    Basically every action we take in the JAVA report takes an average of  28 secs.There are 9 aggregates built on the cube that are barely hit by this query but the same query performing same actions with same selections hit the aggregates many many times.The questions I have is why is ABAP so fast compared to JAVA ? What is true explanation behind this behavior ? What are the dis-advantages by using ABAP engine ? Users are loving the performance and features of ABAP while they weren't really on board with the original JAVA report (as it was slow). ABAP is sure enough 10 times faster than JAVA. Query/Query Properties are exactly the same in ABAP and JAVA.Please explain.
    Cheers
    RT

    Hi All,
    Thanks to all you for your responses. I appreciate your time for going through my questions and coming forward to express your views.
    However, I was looking for more specific "factual" answers. My question is "What does a client miss if they opt to install only ABAP based BI 7.0, as against JAVA Based BI 7.0"
    thanks again.
    Naga

  • Change the time zone in Java System only

    Hi there,
    Does anyone knows where to change the time zone in Java system only? I know in ABAP they have t-code: STZAC? where do I change in Java? Configtool or visual admin? what is the service name or parameter for this?
    Thanks
    Kumar

    hi Kumar,
    You can change the timezone of the JVMs using the -Duser.timezone
    parameter,  add -Duser.timezone=<timezone> to all dispatcher and
    server processes in your systems, using the configtool           
    1) open config tool                                              
    2) select yes                                                    
    3) select "cluster-data->instanceXXX->serverXXX/Dispatcher"      
    4) in "Java parameters" add new line "-Duser.timezone=<timezone>"
    5) click "Apply changes"                                         
    6) restart your instance
    Let me know how is the result
    Regards

  • Synchronous Scenario. How to reduce time. Pls advice urgent.

    Hi All,
    I have Synchronous Scenario. It has no BPM , simple synchronous scenario (HTTP --- Webservice).
    It is taking 10 seconds. How can I reduce time of this scenario.
    Pls advice

    Hi,
    The Time Consumption is based on below factors
    1. the amount of data to be processed across the interface.
    2. The response time of Receiver system
    3. Type of Mapping used and implementations of any complex logics with Advanced UDFs etc
    4. Hardware configurations
    5. Resource Consumptions etc.
    please refer below fine tunning docs.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/489f5844-0c01-0010-79be-acc3b52250fd
    XI Performance Benchmarks ?
    Thanks
    Swarup

  • Reduce time

    Hi
    I have records more than one one Lakh in my table.
    1) i have created index for a primary key column.
    2) i have used analytical functions in where condition.
    so now i want to reduce time for that query .. is there any way to reduce time ...???

    BluShadow wrote:
    Or use a laptop and sit on a fast plane or train. The faster it goes to slower time goes. ;)You don't even need to do that!
    A lesser known consequence of general relativity is that time will move slower in a stronger gravitational field. On Earth, one implication of this is that a clock on the second floor of an office building will move faster than one on the first floor. Using the ultra-precise clock setup, the NIST researchers tested this as well. One of the optical clocks was placed about a foot above the other and measurements were taken. They found a fractional frequency change of (4.1±1.6)x10-17; plugging this number back into relativity's formulas produced an equivalent height differential gave 14.5±5.9 inches, a result that nicely bracketed the 12 inch difference in the experimental setup.http://arstechnica.com/science/news/2010/09/einsteins-relativity-measured-in-newtons-domain.ars

  • Set Date Time Computer with Java in Linux OS

    Dear All,
    How to set date time computer with Java in linux OS?
    Rgds,
    Theo

    There is no API for this you'd have to run an external command using Process.exec.
    This is the wrong forum for general Java "how to" questions.

  • Reg Custom Time Zone in java

    Hi ,
    Have configured the custom Time Zone (SAST) in the Linux box.
    The sh clock of the Linux box gives the custom Time Zone (SAST).
    Whereas the java application gives the date in GMT Time Zone.
    Noticed from the java docs that, if the custom time zone string (SAST) doesn't match the syntax ( like GMT +Value or GMT-Value) , "GMT" is used.
    Even if we create SimpleTimeZone with offset from GMT, it displays the date in “GMT” format. It won’t display the custom Time Zone.
    Could anybody please suggest me a way to support Custom Time Zone in java?
    (i.e.) The java application should give the date in custom Time Zone (SAST) instead of GMT format.
    FYI : Java version : "1.5.0_17"
    ================== Snippet from java docs====================================
    The format is locale independent and digits must be taken from the Basic Latin block of the Unicode standard. No daylight saving time transition schedule can be specified with a custom time zone ID. If the specified string doesn't match the syntax, "GMT" is used.
    Java doc URL : http://java.sun.com/j2se/1.4.2/docs/api/java/util/TimeZone.html

    hi Kumar,
    You can change the timezone of the JVMs using the -Duser.timezone
    parameter,  add -Duser.timezone=<timezone> to all dispatcher and
    server processes in your systems, using the configtool           
    1) open config tool                                              
    2) select yes                                                    
    3) select "cluster-data->instanceXXX->serverXXX/Dispatcher"      
    4) in "Java parameters" add new line "-Duser.timezone=<timezone>"
    5) click "Apply changes"                                         
    6) restart your instance
    Let me know how is the result
    Regards

  • Log of Time to Start JAVA

    Hello ALL,
    I WOULD LIKE TO KNOW HOW TO DISCOVER THE ELAPSED TIME
    FOR THE STOP/START OF JAVA PROCESS
    Is the one transaction specificed in XI or S.O?
    Kind Regards.

    Hi Produção,
    you can find out the elapsed time of the java server process via the SAP management console (MMC), under AS Java Process Table
    Best Regards,
    Christian

  • Reduce Time for Rman Backup

    Dear Experts;
    rman for 0 level backup is taking about 5:26 hours, backup size is now 312gb I have enabled block track checking & it reduces time for incremental level 1 from 2hour to almost 3 minutes.
    database shows biggest tablespace is "users"
    I want valuable suggestions for reducing its time or is there any way to break 0 level backup. I can allocate channels but ultimately it will take time when taking "users" tablepace backup
    Right now I am taking backup at usb drive & its version is 2.0
    Regards

    As you are taking backup to a usb drive there is not much that can be done to improve the speed. If you are concerned about the backup being slow.. then you could think of taking the backup on local disk( which would be faster and more efficient) and then move the backups from the disk to usb drive.
    This can be done in a single backup script as 2 part operation.
    1) take backup to disk.
    2) copy the backup to usb drive and delete the backups from the disk.
    There are many additional features that u can add to enhance it thoe.
    Regards,
    V

  • How can I clean up queue one-time on Sun Java system messaging 6.3

    Hi,
    <address>Our Email server have a problem, When I run _./imsimta qm directory tcp_local_, There are about 5 Millions of messages in the queue.</address>
    Now our Email server send messages very slowly, how can I clean up queue one-time?
    the command _./imsimta qclean_ is very slowly.
    What can I do to prevent this problem?
    our Email server version is :
    Sun Java(tm) System Messaging Server 6.3-6.03 (built Mar 14 2008; 32bit)
    libimta.so 6.3-6.03 (built 17:12:37, Mar 14 2008; 32bit)
    SunOS email-1 5.10 Generic_120011-14 sun4u sparc SUNW,Sun-Fire-V890
    Thank you !

    If you have more than 100,000 messages in the queue, then look at the MAX_MESSAGES parameter in [the job_controller.cnf file|http://wikis.sun.com/display/CommSuite/Job+Controller+Configuration+File]. If the parameter is not specified, it defaults to 100000. If you have more than that number of messages in the channel queues, it will take a long time for new/legitimate messages to be sent because job_controller is only considering the first 100,000 messages in the queue.
    If you get into the "imsimta qm" command do do "sum -database", it will show a summary of what job_controller has in its internal cache and therefore what job_controller is working on. If you compare that to "sum -directory" you will probably see a difference.
    If these are all legitimate messages, you need to increase MAX_MESSAGES, cnbuild, and restart job_controller.
    If they are not, then preventing this in the future will require determining how they got into your queue and correcting that.
    As for removing them, the "imsimta qm" commands allow you to select messages by various criteria and then you can "return" or "delete" them. But yes, that will take a long time if there are many messages because it is a single threaded process and it needs to open and examine each message. You may be able to accomplish the task more quickly with a shell script that works on individual channel queue subdirectories and then run multiple copies of that script in parallel. After you have cleaned out the queue, restart job_controller.
    Also, you might want to consider [the subdirs channel keyword|http://msg.wikidoc.info/index.php/Subdirs_and_nosubdirs_Channel_Options].

  • Mac 10.9.5 trying to launch Illustrator CS6 for first time and prompts Java even though I have Java 8 installed.

    Mac 10.9.5 trying to launch Illustrator CS6 for first time and won't launch, prompts for Java 6 even though I have Java 8 installed!
    Apple says Java 6 is very insecure and not to use it.  I have the latest Java installed.  Why won't Illustrator launch?  What else can I do?

    tm,
    I believe you should be able to get round the issue by following this:
    http://oliverdowling.com.au/2014/03/28/java-se-8-on-mac-os-x/
    It is even more thoroughly described in this thread, see post #3 on by gator soup:
    https://forums.adobe.com/thread/1706469

  • Setting compile date & time to a Java String variable

    I was wondering does the NetBeans IDE have a capability to grab the current compile date & time and set it to a Java String, updating it at each compile. I know you can set is in a template, but isn't that fixed once forever when the file is created.
    Just wondering.

    If you're using Ant you can have it maintain a file with the last build date in it, and that can be a .java file if you so desire.
    Applications should be completely recompiled before shipping or deployment so it doesn't really make sense to have a compile date per Java source file.

Maybe you are looking for

  • 2560x1440 quit on macbook with miniDP to DP

    My macbook quit displaying 2560x1440. It is a late 2009 13 inch notebook with the NVidia GeForce 9400M graphics. I connected the display to another mac to learn that the display and cable worked perfectly. Therefore, the problem was with my macbook.

  • Copy-Paste Big problem on FW CS4!!!

    Hi, I have this big problem in the very bad big moment Trying to pase text from pages or ms word or even text edit and for example "It's So Much More Than an ID Tag." into FW. And I get "Itís So Much More Than an ID Tag." instead. (notice ITS words).

  • Just installed Arch, can't perform tasks like useradd/pacman [Solved]

    Followed the Beginner's Guide step by step. I'm now on the 'Extra'. However I'm running into problems doing anything. The first thing I tried to do was change user password. I got 'Authentication token lock busy'. Tried to add user and got 'cannot lo

  • Filtering results in an MDX Query

    This is the current MDX Query I have WITH MEMBER [Measures].[Prcnt] AS [Measures].[Value]/[Measures].[Fact Client Score Count] SELECT NON EMPTY { [Measures].[Value], [Measures].[Fact Client Score Count], [Measures].[Prcnt] } ON COLUMNS, NON EMPTY [Di

  • About Master data loading

    How the Master data will be loaded from R/3  to BW? Just u give detailed answer and if possible navigation. and if any important points are related with it, just u tell me.