Skip to content
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

dynamic module second import still slowly when has import std@0.56.0/http/server.ts #6226

Closed
shynome opened this issue Jun 10, 2020 · 4 comments

Comments

@shynome
Copy link

shynome commented Jun 10, 2020

deno version

debian 10

deno 1.0.5
v8 8.4.300
typescript 3.9.2

report steps

you need wrk or other tools for test

  • git clone https://github.com/shynome/deno-report-dynamic-module-exec-so-slowly.git
  • cd deno-report-dynamic-module-exec-so-slowly
  • deno run -A server.ts
  • curl http://127.0.0.1:8000/b work fine
  • curl http://127.0.0.1:8000/c work fine
  • wrk http://127.0.0.1:8000/b my qps test result is 79
  • wrk http://127.0.0.1:8000/c my qps test result is 6389

difference

the difference is b.ts has imported type import type { ServerRequest } from "https://deno.land/std@0.56.0/http/server.ts", if I remove this line, b.ts will work fine

//b.ts
import type { ServerRequest } from "https://deno.land/std@0.56.0/http/server.ts";
export default (req: ServerRequest) => {
  req.respond({ body: "bbbb" });
};
//c.ts
//import type { ServerRequest } from "https://deno.land/std@0.56.0/http/server.ts";
export default (req: any) => {
  req.respond({ body: "bbbb" });
};
@shynome
Copy link
Author

shynome commented Jun 11, 2020

I have update reproudce repo, the new repo has less code and make test easier

@shynome
Copy link
Author

shynome commented Jun 11, 2020

When I add a simple module cache to the code, both qps are close to 20k in my PC

I think import should have a cache, but I don't know the import is
whether equally slow in the browser

@shynome shynome changed the title [Bug Report] dynamic module exec slowly when has import std@0.56.0/http/server.ts [Bug Report] dynamic module import slowly when has import std@0.56.0/http/server.ts Jun 11, 2020
@shynome shynome changed the title [Bug Report] dynamic module import slowly when has import std@0.56.0/http/server.ts dynamic module second import still slowly when has import std@0.56.0/http/server.ts Jun 12, 2020
@shynome
Copy link
Author

shynome commented Jun 13, 2020

node dynamic import is also heavye, but deno dynamic import is look like have ignore the compiled files and recompile everytime

@bartlomieju
Copy link
Member

@shynome double compilation problem was fixed in #6177. Closing as resolved, feel free to reopen if you're still experiencing problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants