Skip to content

Commit

Permalink
refactor(reflection): prefer Bump_Vector over std::vector
Browse files Browse the repository at this point in the history
Reduce our use of std::vector to reduce binary bloat:
#689
  • Loading branch information
strager committed Oct 27, 2023
1 parent 640b5e7 commit da23750
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/quick-lint-js/reflection/cxx-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <quick-lint-js/util/integer.h>
#include <quick-lint-js/util/pointer.h>
#include <string_view>
#include <vector>

using namespace std::literals::string_view_literals;

Expand Down
9 changes: 6 additions & 3 deletions src/quick-lint-js/reflection/cxx-parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <quick-lint-js/container/fixed-vector.h>
#include <quick-lint-js/container/monotonic-allocator.h>
#include <quick-lint-js/container/padded-string.h>
#include <quick-lint-js/container/vector.h>
#include <quick-lint-js/port/char8.h>
#include <quick-lint-js/port/span.h>
#include <string_view>
#include <vector>

namespace quick_lint_js {
class CLI_Locator;
Expand Down Expand Up @@ -197,8 +197,11 @@ class CXX_Diagnostic_Types_Parser : private CXX_Parser_Base {

using Base::fatal_at;

std::vector<CXX_Diagnostic_Type> parsed_types;
std::vector<Diag_Code_Definition> reserved_codes;
Monotonic_Allocator allocator_{"CXX_Diagnostic_Types_Parser"};
Bump_Vector<CXX_Diagnostic_Type, Monotonic_Allocator> parsed_types{
"parsed_types", &this->allocator_};
Bump_Vector<Diag_Code_Definition, Monotonic_Allocator> reserved_codes{
"reserved_codes", &this->allocator_};
};

// Precondition: variables.size() <= 4
Expand Down

0 comments on commit da23750

Please sign in to comment.