getFileInfo() is really slow

Description

this takes 188ms on an empty file with 5.3.5

ACF and Lucee 4.5 take 1ms

https://trycf.com/gist/f720c23b3fa9fd87dedf2f654025549a/lucee?theme=monokai

FileInfo() performs as expected

Environment

1.8.0_221 (Oracle Corporation) 64bit
Windows 10 (10.0) 64bit

Attachments

1

relates to

Activity

Show:

Michael Offner 24 April 2020 at 06:50

pulled thanks for your work on this

KabutoTX 23 April 2020 at 20:28

I submitted a pull request. I hope I did it right. I changes the getAttribute() and setAttribute() functions.

Zac Spitzer 23 April 2020 at 06:56

nice work! can point you in the right direction

there’s also a few more ls command in the same file and a chmod just below it

KabutoTX 23 April 2020 at 01:15
Edited

Yes. I forgot. DosFileAttributes supports Archive and System. isHidden() is already there.

I changed some code and it is now 0-4ms on Windows from ~90ms. Didn’t test on Linux.

What I don’t know is the correct way it should be implemented. You could change FileResource.java getAttribute() code to use DosFileAttributes instead of running attrib
OR
change the isArchive() and isSystem() overrides and get rid of the few getAttribute() calls. I don’t know why the others were deprecated in Resource.java to start using getAttribute().

There is a setAttribute() that is using attrib also that probably needs to be changed to NIO.

Zac Spitzer 22 April 2020 at 18:48

Doesn't NIO support reading these attributes since java 7, should be no need to spawn attrib?

Fixed

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Affects versions

Created 2 October 2019 at 13:40
Updated 2 March 2021 at 09:05
Resolved 4 May 2020 at 16:15