1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +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:
Andreas Kling 2018-11-13 00:17:30 +01:00
parent 5e8e554f94
commit 19b9401487
10 changed files with 60 additions and 40 deletions

View file

@ -30,6 +30,13 @@ public:
m_buffer[m_offset++] = (byte)(value >> 24) & 0xffu;
}
void operator<<(const char* str)
{
size_t len = strlen(str);
for (unsigned i = 0; i < len; ++i)
m_buffer[m_offset++] = str[i];
}
void operator<<(const String& value)
{
for (unsigned i = 0; i < value.length(); ++i)