File.length() too slow?

I'm working on an application that needs to process directory listings on network fileserver, looking for files and directories, and getting basic info about files found (size, last modified date).
I'm trying to use java.io.File.list(java.io.FileFilter) with java.io.FileFilter returning file.isDirectory() or file.isFile() to get a list of just files or directories, and try to get the rest of file information later for each of the returned Files. However, when it gets to a directory with a lot of files (13000+), it seem to be unacceptably slow. I have tracked it down to File.length(), taking up to 80ms per file (!), which amounts to only about 13 files per second.
It's not a problem of the platform (Win XP), directory listing contianing all information I need takes less than 3 seconds for this big directory, while getting the same through Java APIs (calling isDirectory(), isFile(), length() and lastModified() within the FileFilter callback ) takes ages.
Is there a better way to get a directory listing, without being orders of magnitude slower than necessary? I can think of calling native dir command and parsing the output, but that is a mess...

I have tracked this down to native implementation of File.length() - VC++ runtime function _stati64 which they use to get file length is too slow.
Why dont they use Windows API? I have tested that getting file size using GetFileAttributesEx() is at least 50x faster than _stati64 for my file!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Switch log file is too slow

    hello,
    my database is 10R2
    the specified size of online redolog file is 50mb
    the switching of log file is too slow..
    even though the size of archived log file has become around 50,029,there is still no log switch of file..
    why the log switch is not occuring immediately after the size reaches upto that limit(50,029)...?
    what might be the setting do i need to do..
    any help ....any guess ??
    thank you..

    Hello,
    The frequency of the log switch depends on the activity of the Database.
    You may check the Alert log for some messages like this:
    Thread 1 cannot allocate new log, sequence ...
    Checkpoint not completeWhile Oracle needs informations in the Redo log to complete the Checkpoint, it cannot reuse it. So, it can happen that the Database doesn't switch the redo log up to the Checkpoint is complete.
    If you have this kind of messages, the following link may help you:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:69012348056
    Often, it's solved by adding redo log files.
    The Parameter fast_start_mttr_target may also help the Database to optimize the checkpoint:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams068.htm
    Else, if you don't have this message ( checkpoint not complete ...), but you want to log switch more frequently (even if the Redo log is not completely full), you have the parameter archive_lag_target. It can help to force log switch every n+ seconds:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams009.htm
    NB: It's not recommended to get log switch too frequently, in general you shouldn't have more than 3 or 4 log switchs every hour.
    Hope this help.
    Best regards,
    Jean-Valentin
    Edited by: Lubiez Jean-Valentin on Mar 5, 2011 11:44 AM

  • File sharing too slow

    Hi,
    I have 2 macs connected via hub. My internet connection is very fast and everything is ok but file sharing is too slow. 1GB takes 8 hours to be transfered.
    Any fix?
    Thanks!

    yup same here, 9 gb file shared via airport extreme from my Macpro 8proc to my 17" Macbook Pro was going to take 4 hrs?????? doing it via firewire now, 10 minutes.
    is there a network setting in missing as both machines obviously have 902.11N and the extreme is setup for N (B/G compatible)??
    jas

  • How do i fix a file where relinking or updating file is too slow and generating 60+MB pdf from a 4mb Indesign file?

    I have an 18 page files linking several pdf images and working with this file is horribly slow.  These pdf images(total of 15) easily take a min to relink or update (pdf's are at max 2mb but majority are less than 1mb).  The Indesign file is only 4mb but when i export or print to pdf I get a 60-70mb file. Exporting or printing these 18 pages easily takes 30 min.  I can't use the file with a higher display quality unless i have the patience of watching a plant grow on that day. I've read a majority of ways why InDesign would be slow. At work im operating Windows 7, Indesign 6 and I have 32MB of RAM.  Extremely frustrating and reminding me of the days of dial up internet.  I've already done a SAVE AS and tried to reduce linked files image size and to no avail has not helped.  I was able to get my 72mb pdf file to reduce to 6mb after using Adobe Acrobat and getting rid of the hidden information but I lose alot of quality in the linework.  I am guessing its because these pdfs are generated from Revit or Autocad is why it might be holding onto some hidden info. So how do i make this file work faster (relink,export,pdf etc)?

    Just to note as well, InDesign only links to files, there's no embedding, you would see a 4mb file, but if it's linked to a 10mb pdf and it has to include all that PDF in the final file then it will be circa 14mb file.
    What you have is a vector heavy PDF and there's no real way to reduce that without losing quality.
    You may have better joy by opening the linked PDFS in acrobat and using File>Print and choose Adobe PDF (or another method) to basically refry the CAD pdfs.
    I'd do this with a copy of all the files though just in case something goes drastically wrong.
    Frankly, I feel it's the nature of how CAD pdfs are made that's causing the downfall here, refrying these and Printing these files to PDF removes a lot of the complicated things happening in CAD files and makes a very dulled down PDF version.
    Once you've done this then try FIle>Export from indesign to make your pdf.

  • Lenovo Beacon file transfer too slow

    dear all, i'm a newby here and i need your help. I own a Beacon with 2x1TB HDD in RAID 0 mode, so when i move datas to Beacon the max. file trasfer speed is up to 5 mb/s. In my opinion this is tooooo slow. Can anyone help me, or say about your file tranfer speed to Beacon. My configuration: Lenovo Beacon +  Netgear 5-port Gigabit Switch (GS305) + Win7 PC. Everything is LAN wired. I already tryed another PC (Notebook) but with the same result. Thank you!

    Beacon use HTTP protocal, and we use Filezilla as benchmark comparison (Note, Filezilla use FTP protocal.)
    Test config: Router, Netgear WGR614 V9 with Lan speed 100Mbps, Thinkpad Notebook (win7) wire connected to router, Beacon wire connected to router .
    Test Result:  Single file speed 5MBPS, and three files 10MBPS by Beacon; single file 11.6MBPS, multiple files 11MBPS

  • Reading from XML file is too slow

    I am trying to read some values from XML file, it takes about 1 or 2 minutes to finish reading, my xml file has about 4000 xml elements. Does anyone know this is normal or something wrong? How could make it faster?
    Thank you

    fine if it helps others... i hope NI will not be angry *fg*
    thx for your bug-report, i do not test the sub.vi until now.
    exchange the OR with an AND, solves the problem with the endless-loop, but error checking will not work (the loop only stops if no error AND no start-tag is found)
    changing the loop termination condition and putting the NOT from the error condition to the no_starttag_flag do both. correctly stops the loop when error occurs OR no further elements found.
    i attached the new sub.vi for version 7.0 and 7.1, also but some colors in the logo, for your convinience
    catweazle
    Attachments:
    xmlFile_GetElements_(Array).vi ‏76 KB
    xmlFile_GetElements_(Array).vi ‏65 KB

  • JMF playback too slow

    Hello, I am wondering if anyone might be able to help me.
    I am developing a J3D world where if u drive into an object using a game pad then a piece of video is played which takes up the whole window and then when it finishes playing the j3D world becomes visbible again.
    My problem is that when you drive into the object and the video is started it plays the .mov files far too slow - i reckon about 1/6th speed with no audio at all.
    I have turned off polling for the JInput side of the game pad behaviour but still the viedo is played at the wrogn speed.
    Has anyone had similar problems of have any ideas which might be able to help me?
    cheers
    Reuben [email protected]

    ypnos wrote:
    Thank you all very much for your very valuable input!
    I indeed found that I did not have libvdpau installed. I now installed the lib and built mplayer-vdpau-svn package. It works like a charm and plays all the videos now, at less than 10% CPU consumption! Without vdpau for decoding, my CPU is still not fast enough.
    So I assume that libvdpau enables to play more formats compared to stock NVIDIA driver (before, I could play some movies like Elephant's Dream, but most only gave error messages). I'm very happy now and proud again of my shiny Thinkpad
    I did the exact same thing yesterday, and finally found out that I had been lacking ``-vo vdpau'' for quite a while. Cheers.

  • IR Report found 1 million record with blob files performance is too slow!

    we are using
    oracle apex 4.2.x
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    mod_plsql with Apache
    Hardware: HP proliant ML350P
    OS: WINDOWS 2008 R2
    customized content management system developed in apex.when open the IR report have 1 ml rows found and each rows have blob(<5MB as pdf/tiff/bmp/jpg) it will be raising rows in future! but the searching performance is very slow!
    how can increasing the performance?
    how can showing progressing status to user while searching progress going on IR report itself?
    Thanx,
    Ram

    It's impossible to make definitive recommendations on performance improvement based on the limited information provided (in particular the absence of APEX debug traces and SQL execution plans), and lacking knowledge of the application  requirements and access to real data.
    As noted above, this is mainly a matter of data model and application design rather than a problem with APEX.
    Based on what has been made available on apex.oracle.com, taking action on the following points may improve performance.
    I have concerns about the data model. The multiple DMS_TOPMGT_MASTER.NWM_DOC_LVL_0x_COD_NUM columns are indications of incomplete normalization, and the use of the DMS_TOPMGT_DETAILS table hints at an EAV model. Look at normalizing the model so that the WM_DOC_LVL_0x_COD_NUM relationship data can be retrieved using a single join rather than multiple scalar subqueries. Store 1:1 document attributes as column values in DMS_TOPMGT_MASTER rather than rows in DMS_TOPMGT_DETAILS.
    There are no statistics on any of the application tables. Make sure statistics are gathered and kept up to date to enable the optimizer to determine correct execution plans.
    There are no indexes on any of the FK columns or search columns. Create indexes on FK columns to improve join performance, and on searched columns to improve search performance.
    More than 50% of the columns in the report query are hidden and not apparently used anywhere in the report. Why is this? A number of these columns are retrieved using scalar subqueries, which will adversely impact performance in a query processing 1 million+ rows. Remove any unnecessary columns from the report query.
    A number of functions are applied to columns in the report query. These will incur processing time for the functions themselves and context switching overhead in the case of the non-kernel dbms_lob.get_length calls. Remove these function calls from the query and replace them with alternative processing that will not impact query performance, particularly the use of APEX column attributes that will only apply transformations to values that are actually displayed, rather than to all rows processed in the query.
    Remove to_char calls from date columns and format them using date format masks in column attributes.
    Remove decode/case switches. Replace this logic using Display as Text (based on LOV, escape special characters) display types based on appropriate LOVs.
    Remove the dbms_lob.get_length calls. Instead add a file length column to the table, compute the file size when files are added/modified using your application or a trigger, and use this as the BLOB column in the query.
    Searching using the Search Field text box in the APEX interactive report Search Bar generates query like:
    select
    from
      (select
      from
        (...your report query...)
      ) r
      where ((instr(upper("NWM_DOC_REF_NO"), upper(:APXWS_SEARCH_STRING_1)) > 0
      or instr(upper("NWM_DOC_DESC"), upper(:APXWS_SEARCH_STRING_1)) > 0
      or instr(upper("SECTION_NAME"), upper(:APXWS_SEARCH_STRING_1)) > 0
      or instr(upper("CODE_TYPE"), upper(:APXWS_SEARCH_STRING_1)) > 0
      or instr(upper("REF_NUMBER_INDEX"), upper(:APXWS_SEARCH_STRING_1)) > 0
      or instr(upper("DATE_INDEX"), upper(:APXWS_SEARCH_STRING_1)) > 0
      or instr(upper("SUBJECT_INDEX"), upper(:apxws_search_string_1)) > 0
      or instr(upper("NWM_DOC_SERIEL"), upper(:APXWS_SEARCH_STRING_1)) > 0
      or instr(upper("NWM_DOC_DESCRIPTION"), upper(:APXWS_SEARCH_STRING_1)) > 0
      or instr(upper("NWM_DOC_STATUS"), upper(:APXWS_SEARCH_STRING_1)) > 0
      or instr(upper("MIME_TYPE"), upper(:APXWS_SEARCH_STRING_1)) > 0
      or instr(upper("NWM_DOC_FILE_BINARY"), upper(:APXWS_SEARCH_STRING_1)) > 0 ))
      ) r
    where
      rownum <= to_number(:APXWS_MAX_ROW_CNT)
    This will clearly never make use of any available indexes on your table. If you only want users to be able to search using values from 3 columns then remove the Search Field from the Search Bar and only allow users to create explicit filters on those columns. It may then be possible for the optimizer to push the resulting simple predicates down into the inlined report query to make use of indexes on the searched column.
    I have created a copy of your search page on page 33 of your app and created an After Regions page process that will create Debug entries containing the complete IR query and bind variables used so they can be extracted for easier performance analysis and tuning outside of APEX. You can copy this to your local app and modify the page and region ID parameters as required.

  • HT1338 My mac is becoming too slow. It takes long to open word documents, pdf files or excel documents or even safari. Can anybody suggest something? I have tried to reduce the number of open applications, but does not seem to work.

    My mac is becoming too slow. It takes long to open word documents, pdf files or excel documents or even safari. Can anybody suggest something? I have tried to reduce the number of open applications, but does not seem to work.

    Hi ...
    Checked to see how much free space there is on the startup disk lately?
    Right or control click the MacintoshHD icon. Click Get Info. In the Get Info window you will see Capacity and Available. Make sure there's a minimum of 15% free disk space.
    Freeing Up Hard Disk Space - Mac GuidesFreeing Up Hard Disk Space - Mac Guides
    If disk space is not the issue, booting in Safe Mode deletes system caches that may help.
    A Safe Mode boot takes longer then a normal boot so be patient.
    Once you see the Desktop, click the Apple menu icon top left corner of the screen.
    From the drop down menu click Restart.
    See if that makes a difference ...

  • Difficulty opening old projects.  Disk too slow, bad files, etc...

    Recently I've been trying to update old song files. I have a bunch of projects from Logic 6 that have trouble in Logic 7. I get tons of "Disk too slow or System Overload" errors and Logic Crashes quite a bit as a result. The songs aren't overly processor intense, so I think something else must be the problem. When trying to move song files into a new project folder, I get "bad file" errors. The audio files will play, but it seems the computer may be having trouble playing them. Anyone have any experience with this?
    g

    Mr Dummy.........
    recently been using os9 - lp6.3.1. a lot.
    much, much more responsive. NONE of the glitches found in Lpro7.
    immediate everything.
    ==============================
    my guess is logic's guts are still in some sort of app wrapper.
    apple have not altered the code, except where needed for the new bells and whistles. (sort of like some form of advanced simulation).
    logic's performance will vary wildly from mac to mac, depending on the osx version and it's hardware.

  • Photoshop CS4 too slow to open files

    Hello all,
    I have a problem, when I open a file on Photoshop CS4, the program open this slowly. I tried with image of various dimensions also 20kb and located on desktop, but photoshop it's always too slow.
    Can you help me???
    Thanks

    One thing that can affect the document opening time is the establishment of the GPU-based display management.
    As a test, go into the Edit - Preferences - Performance dialog and uncheck the [  ] Enable OpenGL setting, then close Photoshop completely.  Now restart Photoshop and try opening documents.  Do you see a substantial change in opening speed?
    Of course, disabling OpenGL is not a viable long-term workaround, as you lose some features.  But if it DOES result in a radically different timing, you could try re-enabling it and going into the Advanced menu and trying the different settings there - for example unchecking every option.  Make sure you close and restart Photoshop after ANY configuraiton change so that you're sure you're testing the new settings.
    Good luck.
    -Noel

  • CoreAudio. Disk is too slow or system overload

    Hi. I am writing you to ask something that might be simple. I am working with Logic 7 pro and with a Powerbook 15 inch, processor 1.25 and ram of 1.25. When I am reproducing some files I got the message:
    Error
    CoreAudio. Disk is too slow or system overload.
    I will appreciate any help
    My mail is
    [email protected]
    Thanx a lot.

    Hmm, I agree with David, get an external firewire drive. I think that the internal disk on your powerbook is 5400 rpm, which can be quite slow. It certainly is not the RAM if you are only running a few tracks. It will probably be the audio data that cannot be read quickly enough by the hard drive. The solution that they might have been about to give you could have been resolution and word length of the audio files you are recording, Are you recording at 44.1khz and 24 Bit? If you are recording higher, try bringing it down if you want CD quality to 24 bits and 44.1khz. Obviously when mastering it it will be dithered, but I, and pretty much everyone else here, would advise recording at 24 bits rather than 16. As for external drives, go for something like 7200 rpm (I think that's what mine are), although you will find faster and much better! I hope this helps, keep asking questions as there are many people here who are very (and much, much more than me hehe) capable of helping you out, and we're all here to learn. Good luck and all the best, Fred

  • Song Playback Too Slow

    I played a song that is labeled in iTunes (Mac OS Mavericks, iTunes version 11.3) as having a length of 2:36.  According to the computer clock, iTunes took something like 2:45 to play the song.  It is audibly noticeable that iTunes is playing songs too slow.  This is a new Apple Mac Mini.  The music files were transferred from a Windows OS.  Appears to happen for both mp3 and aac files.  Anyone else having this issue or know of a solution?  Thanks.

    Sorry little addition:
    It s about an external fw hd working with Logic- not in general slow performance.

  • Java web start application runs too slow...

    Hello,
    I am new to Java Web Start. I have created a java web start application and when i enable web start from local Execution, then it works perfectly well. But when i upload it on server and then download the application, then it is too too slow...i mean it takes minutes to get the output on clicking some button....my jnlp file is as under:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <jnlp codebase="http://(web server code base)" href="launch.jnlp" spec="1.0+">
    <information>
    <title>ERD</title>
    <vendor>Deepika Gohil</vendor>
    <homepage href="http://appframework.dev.java.net"/>
    <description>A simple java desktop application based on Swing Application Framework</description>
    <description kind="short">ER Deign Tools</description>
    </information>
    <update check="always"/>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.5+"/>
    <jar href="ERD_1_2.jar" main="true"/>
    <jar href="lib/appframework-1.0.3.jar"/>
    <jar href="lib/swing-worker-1.1.jar"/>
    <jar href="lib/jaxb-impl.jar"/>
    <jar href="lib/jaxb-xjc.jar"/>
    <jar href="lib/jaxb1-impl.jar"/>
    <jar href="lib/activation.jar"/>
    <jar href="lib/jaxb-api.jar"/>
    <jar href="lib/jsr173_api.jar"/>
    <jar href="lib/ant-contrib-1.0b3.jar"/>
    <jar href="lib/jaxb-impl.jar"/>
    <jar href="lib/jaxb-xjc.jar"/>
    <jar href="lib/FastInfoset.jar"/>
    <jar href="lib/gmbal-api-only.jar"/>
    <jar href="lib/http.jar"/>
    <jar href="lib/jaxws-rt.jar"/>
    <jar href="lib/jaxws-tools.jar"/>
    <jar href="lib/management-api.jar"/>
    <jar href="lib/mimepull.jar"/>
    <jar href="lib/policy.jar"/>
    <jar href="lib/saaj-impl.jar"/>
    <jar href="lib/stax-ex.jar"/>
    <jar href="lib/streambuffer.jar"/>
    <jar href="lib/woodstox.jar"/>
    <jar href="lib/jaxws-api.jar"/>
    <jar href="lib/jsr181-api.jar"/>
    <jar href="lib/jsr250-api.jar"/>
    <jar href="lib/saaj-api.jar"/>
    <jar href="lib/activation.jar"/>
    <jar href="lib/jaxb-api.jar"/>
    <jar href="lib/jsr173_api.jar"/>
    </resources>
    <application-desc main-class="erd.screen1">
    </application-desc>
    </jnlp>
    I dont understand the reason. Could you please help me out.
    Thank you,
    Deepika Gohil.

    Check your web server's access logs to see how many requests web start is sending for each jar. After you've loaded the application the first time, for each subsequent launch, if you've got everything configured right, you should only see requests for the JNLP file and maybe some gifs because web start should load everything else out of the cache (if you're using the version-based download protocol). Or if you're using the basic download protocol, then you might see requests for each jar file, but even in this case, if your web server is prepared to evaluate the last-updated attribute for each jar request and for jars that have not changed, respond with no actual payload and a header value of Not-Modified, then that should run almost as fast.
    You might also want to consider changing the "check" attribute of the "update" element from "always" to "background" for a couple of reasons. It should allow your app to start sooner (but this means that you might have to launch once or twice after an update is applied to the web server before the update shows up on the workstation). Also, my impression is that "always" is broken and prevents web start from ever checking to see if your jnlp file has been updated if you launch your app from a web start shortcut - launching from a browser is less likely to have this problem, depending on how often your browser is configured to check for updated resources.

  • Please Help! All Sounds in Classic are too slow now!

    Something dreadful happened (wish I knew what) and now every sound that is played back by any Classic application is about 70% too slow.
    No matter if it is a Classic game like Unreal (I), Deus Ex, AvP for OS9 (the OSX version works fine), or Quicktime 6, or any other given Classic application. The only sounds that appear normal are the Platinum system sounds.
    I don't know which files affect Classic sound playback or where they are located. Can't imagine what could cause that particular problem.
    Hope someone could help...
    Many thanks in advance
    M:A:
    PowerMac G5 2x2 GHz Mac OS X (10.4.6) 1.5 GB RAM, standard sound card (TI-TAS3004)
    PowerMac G5 2x2

    Sorry, didnt get an email notification, so I just checked the thread.
    Starting and quitting Garage Band actually helped!
    (Imagine listening to the meaningful dialogues in "Deus Ex" spoken with Sesame Street's Cookie Monster voice. Aaaaannnd reeealllly sllloowwww. Doesn't quite capture the mood...)
    Do you have an explanation why Garage Band should affect Classic sound output?
    Thanks a lot,
    Martin

Maybe you are looking for

  • How to send mail with zip file

    Hi, We are sending email in one of our program with an attached xls file. We are sending email using classes (cl_bcs). Our requirement is to send the attached file in zip format to reduce the size. Please provide if you have any pointers to get zippe

  • Duplicates of events in my library?

    My event library has doubles of every event. I know I can just delete the duplicate. This has happened several times. Anyone know what I can do to prevent it? Thanks in advance for any help with this!

  • Is there any way to transfert pics from my pc to my i-pad mini

    First of all my original pics are still in my I-phone 5, but I really want them in my ipad. So if somebody have a software, I did try something with Itunes but when i try to listen those video, it's like if it is to slow...

  • Problem with downloading from itunes

    I can log on to the Apple website to manage my account and all the information is correct, but I get "Your Apple ID has been disabled" when I try to get something from App Store. what is the problem ?

  • Image does not appear where it was placed

    I have inserted an image to appear in the body tag (i.e. it should be within the cream colored section.  It looks great in DreamWeaver Design and in Live Modes.  But when I upload to the server it is placed in the left tag.  What am I doing wrong? I