Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

## YYYY-MM-DD - Optimized logging message formatting
**Learning:** std::format is significantly faster than std::ostringstream for string formatting, especially with chrono types.
<<<<<<< Updated upstream
=======
<<<<<<< Updated upstream
**Action:** Use std::format instead of std::ostringstream for log message formatting in future optimizations.
=======
>>>>>>> Stashed changes
**Action:** Use std::format instead of std::ostringstream for log message formatting in future optimizations.

## 2026-02-02 - IPv4 parser pointer optimization
Expand All @@ -16,13 +10,12 @@

## 2026-02-02 - Log level check lock-free early exit
**Learning:** Replacing mutex-protected level checks with a lock-free atomic read removes frequent mutex acquisitions on filtered log paths. Microbenchmark (`tests::LogFilterPerformance`, 100k iterations) measured ~10ms for filtered debug calls on Linux x86_64.
<<<<<<< Updated upstream
**Action:** Prefer atomic operations on small shared flags that are read frequently and updated rarely (e.g., log level). Add similar microbenchmarks when optimizing hot logging paths.
=======
**Action:** Prefer atomic operations on small shared flags that are read frequently and updated rarely (e.g., log level). Add similar microbenchmarks when optimizing hot logging paths.

## 2026-02-03 - Avoid temporary std::string allocations on filtered logs
**Learning:** Adding `const char*` overloads for log methods and checking the level before constructing a `std::string` avoids temporary allocations when logging string literals that are filtered by log level. This reduces allocation overhead on hot, filtered paths without changing the API behavior for callers using `std::string`.
**Action:** Add `const char*` overloads for common logging entry-points in other modules if needed and add microbenchmarks to `tests/` to track regression."
>>>>>>> Stashed changes
>>>>>>> Stashed changes
**Action:** Add `const char*` overloads for common logging entry-points in other modules if needed and add microbenchmarks to `tests/` to track regression.

## 2026-02-03 - Optimize filesystem read_file with direct string construction
**Learning:** Replacing stringstream-based file reading with direct string construction from istreambuf_iterators eliminates intermediate buffering overhead, providing measurable performance improvement for file I/O operations.
**Action:** Use direct iterator-based string construction for other stream-to-string conversions in the codebase to avoid unnecessary intermediate objects.
4 changes: 1 addition & 3 deletions include/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ class FileSystem
static std::string read_file(const std::string &path)
{
std::ifstream file(path, std::ios::binary);
std::stringstream buffer;
buffer << file.rdbuf();
return buffer.str();
return std::string(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
}

static bool write_file(const std::string &path, const std::string &content)
Expand Down
Loading