MCPcopy Create free account
hub / github.com/FastLED/FastLED / run_large_benchmark

Function run_large_benchmark

tests/profile/benchmark_json_parsers.cpp:134–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134bool run_large_benchmark() {
135 bool success = true;
136
137 printf("\nLoading large JSON file: tests/profile/benchmark_1mb.json\n");
138
139 // Initialize FileSystem for testing
140 FileSystem fs;
141 FsImplPtr fsImpl = make_sdcard_filesystem(0);
142 if (!fs.begin(fsImpl)) {
143 printf("❌ ERROR: Failed to initialize test filesystem\n");
144 return false;
145 }
146
147 // Open and read the JSON file
148 ifstream fh = fs.openRead("tests/profile/benchmark_1mb.json");
149 if (!fh.is_open()) {
150 printf("❌ ERROR: Could not open tests/profile/benchmark_1mb.json\n");
151 printf(" Download it with: curl -o tests/profile/benchmark_1mb.json https://microsoftedge.github.io/Demos/json-dummy-data/1MB.json\n");
152 return false;
153 }
154
155 // Read file contents
156 fl::size file_size = fh.size();
157 fl::string large_json;
158 large_json.resize(file_size);
159 fl::size bytes_read = fh.read(reinterpret_cast<u8*>(&large_json[0]), file_size);
160 fh.close();
161
162 if (bytes_read != file_size) {
163 printf("❌ ERROR: Read %zu bytes but expected %zu bytes\n", bytes_read, file_size);
164 return false;
165 }
166
167 printf("✓ Loaded %zu bytes (%.2f KB)\n", bytes_read, bytes_read / 1024.0);
168
169 run_benchmark("TEST 2: LARGE JSON (1MB Real-World Data)", large_json, 50, success);
170 return success;
171}
172
173void print_usage() {
174 printf("JSON Parser A/B Benchmark\n");

Callers 1

mainFunction · 0.70

Calls 10

printfFunction · 0.85
run_benchmarkFunction · 0.70
make_sdcard_filesystemFunction · 0.50
beginMethod · 0.45
openReadMethod · 0.45
is_openMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected