1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:55:08 +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

@ -26,7 +26,6 @@
#include "VirtualConsole.h"
#include "Scheduler.h"
#define TEST_VFS
#define KSYMS
#define SPAWN_MULTIPLE_SHELLS
//#define STRESS_TEST_SPAWNING
@ -103,7 +102,8 @@ static void loadKsyms(const ByteBuffer& buffer)
// FIXME: The Strings here should be eternally allocated too.
ksyms().append({ address, String(startOfName, bufptr - startOfName) });
kprintf("\033[u\033[s%u/%u", ksyms().size(), ksym_count);
if ((ksyms().size() % 10) == 0 || ksym_count == ksyms().size())
kprintf("\033[u\033[s%u/%u", ksyms().size(), ksym_count);
++bufptr;
}
kprintf("\n");
@ -174,7 +174,6 @@ static void init_stage2()
{
Syscall::initialize();
#ifdef TEST_VFS
auto vfs = make<VirtualFileSystem>();
auto dev_zero = make<ZeroDevice>();
@ -218,8 +217,6 @@ static void init_stage2()
vfs->mount(ProcFileSystem::the(), "/proc");
#endif
#ifdef TEST_ELF_LOADER
{
auto testExecutable = vfs->open("/bin/id");