-
Notifications
You must be signed in to change notification settings - Fork 625
feat(registry): Add on the fly compilation #1902
Conversation
I'll do some performance check for this change on Deploy. |
Regarding the design aspect, this change responds with javascript context for the |
IMO as long as |
This seems to slow down the start up time of the isolate from about 1.5 sec to 5.0 sec from my location (my location already has 1.0 sec penalty on start up BTW). I'm not sure how much impact it does have to the service. Can't predict for sure whether it's safe to merge this or not (should be merged very carefully anyway) Some numbers to share: deno.land has about 66,000 reqs/hour at the peak today. It's 18.3 reqs/sec. 3.5 sec penalty means additional 64.2 reqs are on hold during deployment (if I understand the deployment process correctly). These numbers are for the entire regions, not a single region. (Deno Deploy has 25 regions, but I guess loads wouldn't be distributed evenly) |
Regarding the functional aspect, I was able to use some of std/collections functions in the browser. The compilation itself seems working! 👍 An example I was able to run on a browser: <script type="module">
import { sortBy } from "https://dry-horse-89.deno.dev/std@0.110.0/collections/mod.ts";
const people = [
{ name: "Anna", age: 34 },
{ name: "Kim", age: 42 },
{ name: "John", age: 23 },
];
const sortedByAge = sortBy(people, (it) => it.age);
console.log(sortedByAge);
</script> (I deployed this branch at https://dry-horse-89.deno.dev) |
I really would like this feature, is there something I can do to help? |
Ideally this would not be on the fly, but rather when a tag is created |
It's a part of the roadmap on the backend. So you should look in that repo first, then we can either change this PR to use that saved stripped version or make a new PR |
@crowlKats Could/should this perhaps be done lazily? So we keep this pull request, but then add another which optimises it by saving the transpiled JS code to |
I tried deploying this and it looks like the isolate start time has improved to 3.10ms. To store the lazily transpiled JS code, I think the cache layer suggested by denoland/deploy_feedback#74 is useful. |
// JSX and TSX content type fix | ||
if ( | ||
remoteUrl.endsWith(".jsx") && | ||
!resp2.headers.get("content-type")?.includes("javascript") |
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.
It seems that resp2.headers.get("content-type")
is repeated multiple times. Why don't you store it in a variable?
} else if ( | ||
remoteUrl.endsWith(".tsx") && | ||
!resp2.headers.get("content-type")?.includes("typescript") | ||
headers.get("accept")?.includes("javascript") || |
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.
headers.get("accept")
is also repeated.
closing because stale |
fixes denoland/website_feedback#19