mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 17:28:30 +00:00
Reduce kmalloc() traffic in directory iteration.
Pass the file name in a stack-allocated buffer instead of using an AK::String when iterating directories. This dramatically reduces the amount of cycles spent traversing the filesystem.
This commit is contained in:
@@ -147,11 +147,11 @@ bool SyntheticFileSystem::enumerateDirectoryInode(InodeIdentifier inode, Functio
|
||||
if (!synInode.metadata.isDirectory())
|
||||
return false;
|
||||
|
||||
callback({ ".", synInode.metadata.inode });
|
||||
callback({ "..", synInode.parent });
|
||||
callback({ ".", 1, synInode.metadata.inode, 2 });
|
||||
callback({ "..", 2, synInode.parent, 2 });
|
||||
|
||||
for (auto& child : synInode.children)
|
||||
callback({ child->name, child->metadata.inode });
|
||||
callback({ child->name.characters(), child->name.length(), child->metadata.inode, child->metadata.isDirectory() ? (byte)2 : (byte)1 });
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user