Increasing the speed of searching a string in a file

I have to search a String in a big ASCII-file and have to delete it. Now I wrote a program which opens the source file and a target file. I am reading each line from the source file, check it and write it into the target file. It is working fine but it is very slowly.
I check each line with:
if (line.equalsIgnoreCase("xxxxx")) { }
How can I make it much faster.
Thank you for your help!
Arthur

IO is an issue, but I've noticed that changing the case of strings is very slow, probably because in unicode is harder than in ASCII.
If you could replace the equalsIgnoreCase method by one or more equals, you'll get benefits. If you can, I would try something like the following to minimize the equalsIgnoreCase invocations:
// Supose you are looking for "abcd"
if (line.charAt(0) == 'a' || line.charAt(0) == 'A') {
   if (line.equals("xxxxx")) { }
}Try it and let us know if it worth the effort.

Similar Messages

  • PLease advise on increasing the speed of my iMac 2008. It is running slowly and accesses the HDD a lot. Perhaps re-installation? Thanks.

    I need to increase the speed of my iMac late 2008 (3.06GHz Intel Core 2 Duo). It has 4G of DDR2 SDRAM and a 500G HDD.
    I back this up regularly with time machine.
    If a fresh installation is advised, how do I do this?
    Thanks

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Click the Clear Display icon in the toolbar. Then try the action that you're having trouble with again. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message (command-V).
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.

  • Whats the best option to increase the speed on my mid 2010 macbook pro?

    What choices are there for me to increase the speed of my computer ?

    More RAM and a SSD. If you're running under 8GB of RAM, I would recommend upgrading to 8GB. You can check out Crucial or OWC for the correct RAM configuration for your model.
    While you're at Crucial, I would also look at the available SSDs that would fit your machine - just use the System Scanner tab, and it will show you the recommended upgrades.
    RAM and SSDs are about the only things you can upgrade to make your computer faster.
    If you're new to SSDs, see my user tip here -> https://discussions.apple.com/docs/DOC-4741.
    Good luck,
    Clinton

  • My performance is very slow when I run graphs. How do I increase the speed at which I can do other things while the data is being updated and displayed on the graphs?

    I am doing an an aquisition and displaying the data on graphs. When I run the program it is slow. I think because I have the number of scans to read associated with my scan rate. It takes the number of seconds I want to display on the chart times the scan rate and feeds that into the number of samples to read at a time from the AI read. The problem is that it stalls until the data points are aquired and displayed so I cannot click or change values on the front panel until the updates occur on the graph. What can I do to be able to help this?

    On Fri, 15 Aug 2003 11:55:03 -0500 (CDT), HAL wrote:
    >My performance is very slow when I run graphs. How do I increase the
    >speed at which I can do other things while the data is being updated
    >and displayed on the graphs?
    >
    >I am doing an an aquisition and displaying the data on graphs. When I
    >run the program it is slow. I think because I have the number of
    >scans to read associated with my scan rate. It takes the number of
    >seconds I want to display on the chart times the scan rate and feeds
    >that into the number of samples to read at a time from the AI read.
    >The problem is that it stalls until the data points are aquired and
    >displayed so I cannot click or change values on the front panel until
    >the updates occur on the graph. What can I do to be a
    ble to help
    >this?
    It may also be your graphics card. LabVIEW can max the CPU and you
    screen may not be refreshing very fast.
    --Ray
    "There are very few problems that cannot be solved by
    orders ending with 'or die.' " -Alistair J.R Young

  • How to increase the speed of video (avi file) using labview

    How to increase the speed of video (.avi file) using labview? I have  tried this by skiping alternate frames. also I have used  minimum time delay.Is there  any other option for which i can go?
    please suggest me........... 

    Are you using NI Vision IMAQ AVI Read Frame or anther method to read the AVI file?
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison

  • How to increase the speed of Zoom on TIFF image

    Hi everyone,
    i m doing zooming operation on tiff image.
    when i applied zoom in operation on image which have properties
    Bit per sample =1
    Image Length = 2200 Pixel
    Image Width = 1700 Pixel
    Resolution(x) = 200 dpi
    Resolution(y) = 200 dpi
    then it require 2 sec.
    then i apply the same code with tiff image which have properties like,
    Bit per sample =1
    Image Length = 3300 Pixel
    Image Width = 2500 Pixel
    Resolution(x) = 300 dpi
    Resolution(y) = 300 dpi
    then it require 9 to 10 sec.
    my code is:
    RenderedImage src= oriRndImage[selectedButtonIndex];(orirndImage is Rendered
    Iamge)
    //Transfer Current RenderedImage object into BufferedImage object
    Raster ra= currRimage.getData(); //it take time.
    DataBuffer db = ra.getDataBuffer();
    SampleModel sa = ra.getSampleModel();
    ColorModel cm = currRimage.getColorModel();
    final BufferedImage currImage = new
    BufferedImage(cm,Raster.createWritableRaster(sa,db,null), false, new
    Hashtable());
    //Create new Bufferred Image
    BufferedImage bi = new BufferedImage(zoomW,zoomH, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = bi.createGraphics();
    double scaleW = (double)(zoomW)/(double)(prev_width);
    double scaleH = (double)(zoomH)/(double)(prev_height);
    transAtZoom = AffineTransform.getScaleInstance(scaleW,scaleH);
    g.drawRenderedImage(src, transAtZoom);
    can any one plz suggest me the way ,how to increase the speed. of Zoom effect?
    how to handle this problem?
    thnxs..

    Are you using NI Vision IMAQ AVI Read Frame or anther method to read the AVI file?
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison

  • I set up time capsule using a wireless 4g modem.  it's been five hours and it still is saying making backup disk available (4.97 GB of 18.52 GB).  Can I stop the whole thing, get a ethernet cable and start over to increase the speed of the backup?

    I set up a new time capsule on a wireless 4g modem.  I started the initial backup.  It's been five hours and it still says "making backup disk available (4.97 GB of 18.52 GB)."  Can I stop the whole thing, connect my computer to the time machine using an ethernet cable and start over to increase the speed of the backup?
    Thanks,
    David

    Bunce wrote:
    oh i already did that. Im working on my imac and looking into this on my macbook. Was able to reproduce the issue again by trying to open TM. Locked out the finder again and had to restart. I checked the serial number and it was an early 2009 purchase with no coverage.
    If you bought a Mac and got AppleCare with it, within 2 years of buying the TC, the TC is covered, too.
    I have to admit that this $500 unit was the first to apparently junk out. The western digital that had my main data on that is my daily external that I store about 2TB of data on is still perfect and the new technology TM appears to already be cashed. Love the computers, not to big of a fan on the externals of the apple TV's. No life expectancy. Neither here nor there.
    suggestions before I either get this looked at or scrap the HD on it and move forward.?
    Reset the TC. See [Resetting an AirPort Base Station or Time Capsule FAQ|http://support.apple.com/kb/ht3728].
    Try a "full reset" of Time Machine, per #A4 in [Time Machine - Troubleshooting|http://web.me.com/pondini/Time_Machine/Troubleshooting.html] (or use the link in *User Tips* at the top of the +Time Machine+ forum).
    If all else fails, take it to your local Apple Store or Authorized Repair location, they may be able to determine whether the disk is dead.
    If it is, they might replace the TC for you. If not, they won't repair it, but if the electronics are ok, you can replace the HD yourself, if you want to. See http://discussions.apple.com/thread.jspa?threadID=2542983

  • M30: Connect only with 42.6K - How to increase the speed

    My M30 connect only with 42.6K speed. I try all options to increase the speed but success. If any one have the solution, please send me email at [email protected]
    I try the other series on my telephone line and those connect at 52 to 54K speed. Even Desktop connect at 54K.

    Hello
    Please go to the device manager and choose the modem. Then right click and properties.
    There you will find a many tabs. Please check if the option Maximum port speed in the Modem tab is set to highest value.
    Furthermore you can check in the Advanced tab the button Advanced Port settings The controller should be also set to the high (max).
    Please check these possibilities.
    Bye

  • How can you increase the speed with a slider

    I have been trying to work at this for about a week and a
    half. I browsed several communities but it seems that noone has an
    answer so I am not even sure if this is possible I am not a flash
    expert but what I am trying to do is as follows;
    I have a movie with several movie clips. I have an animation
    of a female walking, I also have a slider that when I move it to
    the right bags are added on to her. but what I am also trying to
    accomplish is to have her walk faster as the slider moves to the
    right.
    I tried several scripts but they seem not to work as I wan
    them to plus they start to cancel out the bag function.
    How could I make this happen if it is even possible. I want
    to use the slider to increase the speed of the lady walking. Slider
    and Lady are movie clips.
    thanks in advance

    At present I'm not aware of any way to achieve this exact effect in Muse (where the first screen of a web page is resized to fill the browser window and the rest of the page, as you scroll down, appears to be fixed height layout).

  • How to increase the speed of producer-c​onsumer architectu​re

    Hey everyone -
    This is a follow-up to a previous thread that I had posted (
    http://forums.ni.com/t5/LabVIEW/How-to-use-a-dynam​ic-true-false-signal-with-a-case-structure/m-p/114​...
    ), but my next question has taken a bit of a different direction so I have made a new thread. 
    Following tbob's suggestion, I am trying to use a producer-consumer architecture to start and stop data acquisition from a simulated NI 9237 device.  I have attached the current version of our code to this post (Producer_Consumer_architecture.vi).  Our main problem is that there is a significant lag between when elements get added to the queue using the Enqueue function, and when they are removed from the queue using the Dequeue function. As a result, the signals from our simulated DAQ channels run for much longer than they are supposed to, and the start-and-stop of data acquisition is not keeping in time with the simulated square wave signal (we would like our NI 9237 device to acquire data when the square wave has an amplitude over 3, and stop acquiring when the amplitude is under 3).  If you allow the program to run for about 30 seconds, you will see what I mean (press the stop button twice to quit the program).
    If anybody has any suggestions as to how we can increase the speed of the program, they would be very much appreciated!
    Thanks in advance!
    Attachments:
    Producer_Consumer_architecture.vi ‏122 KB
    Save_data.vi ‏14 KB

    hello,
    i don't have tools needed but , i see one thing is that you enqueue 
    every time you are greater 3 that means about every 2-3 ms so consumer is really   sought
    is it really what you want ?
    may be you want to start on a treshold so you can use a treshold fonction 
    if i don't make mistake your square is 10 hz and the daq is configured 25000 sample 25000 hz
    so you aquire 1s of signal every 100ms , there is something to correct
    make tests and tell us
    Regards
    Tinnitus
    CLAD / Labview 2011, Win Xp
    Mission d'une semaine- à plusieurs mois laissez moi un MP...
    RP et Midi-pyrénées .Km+++ si possibilité de télétravail
    Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
    Don't forget to valid a good answer / pensez à valider une réponse correcte

  • How can I increase the speed of importing audio cds into my iTunes library?  On my old Dell PC cds imported at 30-35x, but my new iMac (using the Apple Superdrive) is trudging along at 8-10x.  Any suggestions?

    How can I increase the speed of importing audio cds into my iTunes library?  On my old Dell PC cds imported at 30-35x, but my new iMac (using the Apple Superdrive) is trudging along at 8-10x.  Any suggestions?

    Hi,
    Not sure you can do anything about this. I get vaiable import speeds - a lot depends on the actual disc. The Read Write spec is 24X but I rarely see speeds close to this.
    Jim

  • How can I increase the speed at which I write to a spreadsheet?

    We are trying to acquire data rapidly during a 1.5 second test. We are able to acquire the data at a variety of speeds, but are unable to write it to an Excel spreadsheet any faster than 10 Hz. Is there a way to speed the writing to a file or are we stuck with this rate?
    Thanks

    Hello,
    I noticed your post was in the DAQ group, but you didn�t mention which
    programming language you are using. This answer is tailored to
    LabVIEW, but if you are using something else, let me know. Since you
    are running such a short test, it might be easier to acquire all of
    your data first and then write it to a spreadsheet file.
    If this is not preferable, you could use lower-level file VIs. Using
    a VI such as the �Write To Spreadsheet File� within a while loop is
    inefficient since it opens and closes the file each time it writes a
    new value. One of the fastest ways to write to a file is to first
    open the file. Then in your while loop, perform your data acquisition
    and write to the file. Finally, close the file after your while loop
    completes. If thi
    s is what you are already doing, you could try
    writing to a binary file instead of an ASCII file.
    Try acquiring your data and then writing it to a file. Or try using
    lower-level file VIs to increase the speed of file writing. If this
    does not address your problem, please provide some additional
    information such as the VIs you are currently using to write to the
    file or post all or part of your VI.
    Grant M.
    National Instruments

  • How to increase the speed of my producer loop?

    Hi,
    I try to monitor two CAN channels and to compare values online. That's why I use a producer loop to collect all CAN messages and a consumer loop to calculate some stuff. But the producer is to slow. The queues of my CANCard are full after some minutes. The queues are already set to maximum.
    The first Channel runs with 500 kBit/s, the second one with 125 kBit/s.
    Should I use two Producer loops or how can I increase the speed of my existing producer?
    How should I handle the different speed of the channels?
    Enclosed screenshots from my VI.
    Thanks,
    Thomas
    Attachments:
    producer.jpg ‏66 KB
    receive.jpg ‏38 KB

    Andy,
    thanks for your support!
    Goal of my project is to measure both CAN channels. Between these channels is a real electronic control unit (ecu) which is able to route CAN messages between the channels. My VI has to check weather the routing works fine or not.
    Each message has an identifier and I kow which messages are routed. That means I have to measure both channels, look for routed messages and compare the data and the timestamp of the messages. I try that in my consumer loop. The data are stored in several 2d arrays. And I have to look for specific data in these arrays. I think the loops over the arrays are to slow. but I have no other chance - I have to buffer the messages somehow and then to compare by their timestamps to find the right order. But that's very difficult because the order of the messages in my producer queue is not ordered by the timestamp...
    If you have any idea how to solve the problem better, let me know - I would be happy!
    Thanks,
    Thomas

  • How do you increase the speed of an audiobook?

    I am trying to increase the speed of an audiobook but don't know how to do so on my MacBook Pro.  My computer is on OS X Yosemite.  Please let me know as soon as possible how to do this, as it is sort of urgent. 
    Thank you so much!

    I do not think this is a feature of iTunes.  I recall a post recently where somebody mentioned doing this with Garageband.

  • How to increase the speed on my mini mac

    What is the best way to increase the speed for my mini mac?
    10.4.11
    1.33 ghz
    512 MB drsd ram

    The max RAM for your Mac Mini http://www.everymac.com/systems/apple/mac_mini/specs/mac_mini_g4_1.33.html is 1GB. Increasing to the max RAM will help.
    How much free space do you have on your hard drive. An almost full HD can cause slowness.
    Mac OS X: System maintenance
    http://discussions.apple.com/thread.jspa?messageID=607640
    Mac Tune-up: 34 Software Speedups
    http://www.macworld.com/article/49489/2006/02/softwarespeed.html
    52 Ways to Speed Up OS X
    http://www.imafish.co.uk/articles/post/articles/130/52-ways-to-speed-up os-x/
    Tuning Mac OS X Performance
    http://www.thexlab.com/faqs/performance.html
    11 Ways to Optimize Your Mac's Performance
    http://lowendmac.com/eubanks/07/0312.html
    The Top 7 Free Utilities To Maintain A Mac.
    http://mac360.com/index.php/mac360/comments/the_top_7_free_utilities_to_maintain _a_mac/
     Cheers, Tom

Maybe you are looking for