native-vector-store 0.3.7 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-vector-store",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "High-performance local vector store with SIMD optimization for MCP servers",
5
5
  "main": "index.js",
6
6
  "types": "lib/index.d.ts",
@@ -92,13 +92,16 @@ void VectorStoreLoader::loadDirectory(VectorStore* store, const std::string& pat
92
92
 
93
93
  for (size_t w = 0; w < num_workers; ++w) {
94
94
  consumers.emplace_back([&]() {
95
- // Each thread needs its own parser with large capacity for big files
96
- simdjson::ondemand::parser doc_parser(16 * 1024 * 1024); // 16MB capacity
95
+ // Each thread needs its own parser with initial capacity
96
+ simdjson::ondemand::parser doc_parser(1 * 1024 * 1024 * 1024); // 16MB initial capacity
97
+ // Set a larger maximum capacity for very large files (up to 512MB)
98
+ doc_parser.allocate(512 * 1024 * 1024);
97
99
  FileData* data = nullptr;
98
100
 
99
101
  while (true) {
100
102
  // Try to get work from queue
101
103
  if (queue.try_pop(data)) {
104
+
102
105
  // Process the file
103
106
  simdjson::padded_string json(data->content);
104
107
 
@@ -193,4 +196,4 @@ void VectorStoreLoader::loadDirectory(VectorStore* store, const std::string& pat
193
196
 
194
197
  // Finalize after batch load - normalize and switch to serving phase
195
198
  store->finalize();
196
- }
199
+ }
@@ -132,8 +132,10 @@ void VectorStoreLoader::loadDirectoryAdaptive(VectorStore* store, const std::str
132
132
 
133
133
  for (size_t w = 0; w < num_workers; ++w) {
134
134
  consumers.emplace_back([&]() {
135
- // Each thread needs its own parser with large capacity for big files
136
- simdjson::ondemand::parser doc_parser(16 * 1024 * 1024); // 16MB capacity
135
+ // Each thread needs its own parser with initial capacity
136
+ simdjson::ondemand::parser doc_parser(1 * 1024 * 1024 * 1024); // 16MB initial capacity
137
+ // Set a larger maximum capacity for very large files (up to 512MB)
138
+ doc_parser.allocate(512 * 1024 * 1024);
137
139
  MixedFileData* data = nullptr;
138
140
 
139
141
  while (true) {
@@ -144,6 +146,7 @@ void VectorStoreLoader::loadDirectoryAdaptive(VectorStore* store, const std::str
144
146
  ? simdjson::padded_string(data->mmap->data(), data->mmap->size())
145
147
  : simdjson::padded_string(data->content);
146
148
 
149
+
147
150
  // Check if it's an array or object
148
151
  const char* json_start = json.data();
149
152
  while (json_start && *json_start && std::isspace(*json_start)) {
@@ -217,4 +220,4 @@ void VectorStoreLoader::loadDirectoryAdaptive(VectorStore* store, const std::str
217
220
 
218
221
  // Finalize after batch load - normalize and switch to serving phase
219
222
  store->finalize();
220
- }
223
+ }
@@ -67,13 +67,16 @@ void VectorStoreLoader::loadDirectoryMMap(VectorStore* store, const std::string&
67
67
 
68
68
  for (size_t w = 0; w < num_workers; ++w) {
69
69
  consumers.emplace_back([&]() {
70
- // Each thread needs its own parser with large capacity for big files
71
- simdjson::ondemand::parser doc_parser(16 * 1024 * 1024); // 16MB capacity
70
+ // Each thread needs its own parser with initial capacity
71
+ simdjson::ondemand::parser doc_parser(1 * 1024 * 1024 * 1024); // 16MB initial capacity
72
+ // Set a larger maximum capacity for very large files (up to 512MB)
73
+ doc_parser.set_max_capacity(512 * 1024 * 1024);
72
74
  MMapFileData* data = nullptr;
73
75
 
74
76
  while (true) {
75
77
  // Try to get work from queue
76
78
  if (queue.try_pop(data)) {
79
+
77
80
  // Process the memory-mapped file
78
81
  // For mmap, we need to copy to ensure padding
79
82
  simdjson::padded_string json(data->mmap->data(), data->mmap->size());
@@ -151,4 +154,4 @@ void VectorStoreLoader::loadDirectoryMMap(VectorStore* store, const std::string&
151
154
 
152
155
  // Finalize after batch load - normalize and switch to serving phase
153
156
  store->finalize();
154
- }
157
+ }