#1 2025-03-14 11:14:43

TPrami
Member
Registered: 2010-07-06
Posts: 128

Gettin file attribuites (fast) on Windows.

https://www.wholetomato.com/blog/2024/1 … n-windows/

Not super easy to adapt in own code, and 50x promice is only for c++ side.

But might be nice to check those Windows API:s own code libraries.

-Tee-

Offline

#2 2025-03-14 21:07:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,919
Website

Re: Gettin file attribuites (fast) on Windows.

The mormot.core.os.windows.inc file already includes the fastest method, i.e. GetFileAttributesEx.
With no memory allocation needed if TFileName is not an UnicodeString (e.g. on FPC or old Delphi).
It also can automatically switch to extended path names for lengths > 260 chars.

And with other specific functions to retrieve all needed information like size or timestamp in a single syscall.

Offline

#3 2025-03-15 07:31:22

zed
Member
Registered: 2015-02-26
Posts: 106

Re: Gettin file attribuites (fast) on Windows.

ab wrote:

The mormot.core.os.windows.inc file already includes the fastest method, i.e. GetFileAttributesEx

But, the article says that the FindFirstFileEx is the fastest one.

Offline

#4 2025-03-15 09:13:45

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,919
Website

Re: Gettin file attribuites (fast) on Windows.

I experimented the contrary when you want to know one file information.

This benchmark is very misleading: it is about reading the information about files in a folder.
Of course, for this FIndFirstFileEx() is the fastest.
It even compares apples and oranges, because their FindFirstFileEx() does not even make any usages of the input "files" array parameter.
Very doubtful and misleading information.

Offline

Board footer

Powered by FluxBB