From ef5ed199544a5230226b8563205d33d2539ab23e Mon Sep 17 00:00:00 2001 From: Cedric Sirianni Date: Fri, 3 Nov 2023 15:01:52 -0400 Subject: [PATCH] perf: use vector reserve --- backend/src/main.cpp | 1 - backend/src/server.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/main.cpp b/backend/src/main.cpp index a6a1844..7300b0e 100644 --- a/backend/src/main.cpp +++ b/backend/src/main.cpp @@ -22,7 +22,6 @@ int main() // test password passwords.insert("TestPass1&"); db.execute("INSERT INTO passwords (password) VALUES ('TestPass1&');"); - db.printTable("passwords"); // Enable CORS crow::App app; diff --git a/backend/src/server.cpp b/backend/src/server.cpp index f29cc12..4e575e8 100644 --- a/backend/src/server.cpp +++ b/backend/src/server.cpp @@ -17,8 +17,8 @@ namespace server CROW_ROUTE(app, "/passwords") ([passwords]() { crow::json::wvalue response; - // TODO: change this to be a list std::vector result; + result.reserve(passwords.size()); for (const auto &password : passwords) { result.push_back(password);