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

Remove profiler #914

Merged
merged 7 commits into from
Feb 18, 2025
Merged

Remove profiler #914

merged 7 commits into from
Feb 18, 2025

Conversation

Dentosal
Copy link
Member

@Dentosal Dentosal commented Feb 18, 2025

Nobody uses the profiler. The profiler pollutes gas charging code. The profiler hurts performance. The superset of this functionality is already available with the debugger. After disussing with @xgreenx, we deemed that removing the profiler is the way to go.

This is a breaking change. I'm quite certain nobody is using this, though, and the replacement is already available.

Since this is supposed to improve benchmarks, we probably want to update gas costs. The effect should be quite even betweeen all opcodes though.

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • If performance characteristic of an instruction change, update gas costs as well or make a follow-up PR for that
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • I have reviewed the code myself
  • I have created follow-up issues caused by this PR and linked them here

@Dentosal Dentosal self-assigned this Feb 18, 2025
@Dentosal Dentosal added breaking A breaking api change fuel-vm Related to the `fuel-vm` crate. labels Feb 18, 2025
@Dentosal Dentosal marked this pull request as ready for review February 18, 2025 16:46
@Dentosal Dentosal requested a review from a team February 18, 2025 16:46
Copy link
Member

@MitchTurner MitchTurner left a comment

Choose a reason for hiding this comment

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

LGTM. Just a few nits and questions.

@@ -52,7 +51,7 @@ fn test_load_contract_in_script() -> IoResult<(), MemoryStorageError> {
context: &Context::Script {
block_height: Default::default(),
},
profiler: &mut Profiler::default(),

Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change

@@ -111,7 +108,7 @@ fn test_load_contract_in_call() -> IoResult<(), MemoryStorageError> {
context: &Context::Call {
block_height: Default::default(),
},
profiler: &mut Profiler::default(),

Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change

@@ -134,17 +127,15 @@ fn test_code_root_contract_not_found() {
memory: &mut memory,
storage: &storage,
gas_cost,
profiler: &mut Default::default(),

Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change

@@ -184,17 +174,15 @@ fn test_code_root_contract_not_in_inputs() {
memory: &mut memory,
storage: &storage,
gas_cost,
profiler: &mut Default::default(),

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

@@ -143,7 +143,7 @@ fn test_mint(
context: &context,
receipts: &mut receipts,
memory: &mut memory,
profiler: &mut Profiler::default(),

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

@@ -213,7 +209,7 @@ struct TransferCtx<'vm, S, Tx> {
context: &'vm Context,
balances: &'vm mut RuntimeBalances,
receipts: &'vm mut ReceiptsCtx,
profiler: &'vm mut Profiler,

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

@@ -108,7 +108,7 @@ where
context: self.context,
balances: self.balances,
panic_context: self.panic_context,
profiler: self.profiler,

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

@@ -198,7 +198,7 @@ where
context: self.context,
balances: self.balances,
panic_context: self.panic_context,
profiler: self.profiler,

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

Comment on lines -324 to -326
pub(crate) fn contract_id(&self) -> Option<ContractId> {
self.frames.last().map(|frame| *frame.to())
}
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It was used only for debugger=)

Comment on lines -1216 to -1219
pub current_contract: Option<ContractId>,
pub cgas: RegMut<'vm, CGAS>,
pub ggas: RegMut<'vm, GGAS>,
pub is: Reg<'vm, IS>,
Copy link
Member

Choose a reason for hiding this comment

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

Why are current_contract and is removed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It was used by profiler

Comment on lines -324 to -326
pub(crate) fn contract_id(&self) -> Option<ContractId> {
self.frames.last().map(|frame| *frame.to())
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It was used only for debugger=)

Comment on lines -1216 to -1219
pub current_contract: Option<ContractId>,
pub cgas: RegMut<'vm, CGAS>,
pub ggas: RegMut<'vm, GGAS>,
pub is: Reg<'vm, IS>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It was used by profiler

@Dentosal Dentosal added this pull request to the merge queue Feb 18, 2025
Merged via the queue into master with commit a39c9c7 Feb 18, 2025
39 checks passed
@Dentosal Dentosal deleted the dento/remove-profiler branch February 18, 2025 18:00
@Dentosal Dentosal mentioned this pull request Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking api change fuel-vm Related to the `fuel-vm` crate.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants