-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(http/file_server): read fileinfo in parallel #3363
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -255,7 +253,6 @@ export async function serveFile( | |||
return createCommonResponse(Status.OK, file.readable, { headers }); | |||
} | |||
|
|||
// TODO(bartlomieju): simplify this after deno.stat and deno.readDir are fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This is an ancient comment by Kevin and this doesn't seem relevant anymore. https://github.com/denoland/deno_std/pull/15/files#diff-106086daad2313990285a9c61085eeb5995d479127db151e613f84ea709450c8R104
@@ -23,8 +23,6 @@ interface EntryInfo { | |||
name: string; | |||
} | |||
|
|||
const encoder = new TextEncoder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Response
object take care of encoding, and this is unnecessary now. Nice clean up.
Thank you for your review! 🙇♂️ There is a PR on deno_blog that does a similar optimization. If you don't mind, please take a look when you have time. denoland/deno_blog#116 |
part of #3361
Previously, fileInfo was read serially when generating directory listing pages. Change this to read in parallel.
After this PR, the display of the directory listing (page below) is tens of milliseconds faster.
benchmark code: