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

perf: lazy bootstrap options - first pass #21164

Merged
merged 10 commits into from
Nov 13, 2023

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Nov 11, 2023

Move most runtime options to be lazily loaded. Constant options will be covered in a different PR.

Towards #21133

@littledivy littledivy changed the title [wip] perf: lazy bootstrap options perf: lazy bootstrap options [wip] Nov 11, 2023
@littledivy littledivy changed the title perf: lazy bootstrap options [wip] perf: lazy bootstrap options - first pass Nov 12, 2023
@bartlomieju
Copy link
Member

What's the impact on startup time?

@littledivy
Copy link
Member Author

/bench startup_nop_trivial

@denobot
Copy link
Collaborator

denobot commented Nov 12, 2023

startup_nop_trivial

time user system relative
node 21 ms 16 ms 6 ms +104.8%
bun 10 ms 4 ms 6 ms best
deno 15 ms 9 ms 6 ms +45.2%
deno-baseline 15 ms 10 ms 6 ms +46.7%

start: Sun, 12 Nov 2023 12:53:28 GMT

id: ce37df81-6352-49c6-96fb-b7f9d6bc7abb

server: 6d3477a6-f5bb-46cf-a536-6f1ccdd797d6

@littledivy
Copy link
Member Author

Not significant. We'll see big improvement once we get rid of the
bootstrap fn call

Comment on lines +39 to +43
#[op2]
#[string]
pub fn op_bootstrap_user_agent(state: &mut OpState) -> String {
state.borrow::<BootstrapOptions>().user_agent.clone()
}
Copy link
Contributor

@mmastrac mmastrac Nov 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More for information than a request for a change:

Given that we have to clone strings to return them and that the ops are not fast, I think it would be reasonable if you want to return the entire BootstrapOptions as a #[serde] return since it's a one-off on first use. It might simplify the code overall and I don't think it'll have a measurable impact on boot time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure that's an option too. Let's do that afterwards maybe? I don't want to solidify this approach until we get to see some improvements after the removal of bootstrap call (proabably a few more PRs before that's possible)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good... merge when you're ready!

Copy link
Contributor

@mmastrac mmastrac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Some minor comments/nits only.

@mmastrac
Copy link
Contributor

Not significant. We'll see big improvement once we get rid of the bootstrap fn call

I need to turn off the zero-decimal place rounding here on kijunsan....

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I agree with Matt's comment about naming.

@littledivy littledivy enabled auto-merge (squash) November 13, 2023 04:47
@littledivy littledivy merged commit 1ef617e into denoland:main Nov 13, 2023
13 checks passed
@mmastrac
Copy link
Contributor

/bench startup_nop_trivial

@denobot
Copy link
Collaborator

denobot commented Nov 13, 2023

startup_nop_trivial

time user system relative
node 23.369 ms 18.205 ms 6.364 ms +102.8%
bun 11.525 ms 5.091 ms 7.635 ms best
deno 15.305 ms 9.782 ms 6.745 ms +32.8%
deno-baseline 15.233 ms 10.055 ms 6.388 ms +32.2%

start: Mon, 13 Nov 2023 15:45:37 GMT

id: 4b238d33-a780-4798-9acd-760d58517ff7

server: 821a7154-cd84-4aa7-b5c4-02237c3c333f

kt3k pushed a commit that referenced this pull request Nov 17, 2023
Move most runtime options to be lazily loaded. Constant options will be
covered in a different PR.

Towards #21133
zifeo pushed a commit to metatypedev/deno that referenced this pull request Nov 22, 2023
Move most runtime options to be lazily loaded. Constant options will be
covered in a different PR.

Towards denoland#21133
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

Successfully merging this pull request may close these issues.

None yet

4 participants