final stopWatch = Stopwatch()..start();
final body = await context.request.body();
print('Request body took ${stopWatch.elapsedMilliseconds}ms');
print('Body was ${utf8.encode(body).lengthInBytes} bytes.');
stopWatch.stop();
Which gives me the following result, when using a very short request body (218 bytes):
With a longer request, the time it takes to await is practically the same:
600ms when calling await context.request.body() is way too long, and causes a performance bottleneck.
Requirements
[ ] All CI/CD checks are passing.
[ ] There is no drop in the test coverage percentage.
Additional Context
Additional information:
Test was ran locally using dart_frog dev
Running on Dart Frog 1.1.0, according to pubspec.lock
Request data is compressed and encrypted when sent to Dart Frog server, but there was no difference that I found when not using compression/encryption.
I tried running without the CORS headers middleware, and the result was the same.
Very rarely the time to load the body was 0ms. This makes me think it's a caching issue.
Description
I have an endpoint that only uses root middleware to setup CORS for Shelf, like so:
I run the following code in my endpoint:
Which gives me the following result, when using a very short request body (218 bytes):
With a longer request, the time it takes to await is practically the same:
600ms when calling
await context.request.body()
is way too long, and causes a performance bottleneck.Requirements
Additional Context
Additional information:
dart_frog dev