-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 framework] No-op methods for setup and cleanup and the global ones #13125
[Perf framework] No-op methods for setup and cleanup and the global ones #13125
Conversation
|
||
public run?(abortSignal?: AbortSignalLike): void; |
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.
Question: Should we remove this as we only ever offer async methods for our APIs?
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.
In a future PR, as it would involve modifying the framework.
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.
Yes, I would remove all the sync code in a separate PR.
A no-op implementation of the base method seems misleading to me. These methods do nothing by default nor need to be implemented for the PerfStress framework to work. If we wanted to do stuff at that level in the core, we could do it outside of a base definition of these methods. Can we not do this? |
@sadasant: I consider this a question about the recommended pattern of
Does TS commonly use a different pattern for |
@mikeharder just for the record, we talked and I understand where you come from and I'm not against this approach. I'm deferring this decision to @HarshaNalluru and @xirzec 👍 I know what they decide will be ok. |
My take on this: TS doesn't have a As we probably don't want the perf stress framework to fail horribly if someone forgets to call So there's no real compelling reason for me to force users to write |
@xirzec: I'm not sure how things usually work in the JS/TS ecosystem. But in .NET, if you override a virtual method, you are responsible for understanding the contract and whether or not you need to call the base method. For example, if you override a method like In .NET, I would say you should default to calling I would expect inheritance in JS/TS to have the same expectations, but if not then we might need to take a deeper look at the whole Perf framework, since it was designed around .NET-style inheritance. |
@xirzec: Note this is about more than just the |
Classes are a relatively newer concept to JS. As they are not widely used as much as in .NET at least, calling base class' methods such as That said, I feel the model of the framework is perfectly fine. If the developer who'd write the test with a base class such as When it comes to the While I totally love the concept of "understanding the contract" and "calling the base method" from the .NET perspective, and though it is completely valid to follow the same pattern in TS, it might be a foreign concept relatively as pointed out.
|
@HarshaNalluru: Of the 3 options in the Gist, my preference is 3 (require all subclasses to call super), followed by 1, and then 2. I don't like forcing all perf tests to implement all 4 setup/cleanup methods since they are often empty. But whatever the JS team decides is fine with me. In example 3, I think there is a bug where StorageBlobTest is not calling super. |
Thanks, @mikeharder! I'll check with @xirzec and finalize. |
I'm curious how you plan to accomplish this. If you can't make it a TS error, I submit you can't "require" it in any meaningful way. |
Yes, we won't be able to force the users into calling methods such as So, to conclude, going with Option-1 seems to be the best as it doesn't add the overhead when compared to Option-3 and it doesn't force users to specify empty methods like Option-2. And since Option-1 is what we currently have in the framework, I'm closing this PR. |
globalSetup
,globalCleanup
,setup
andcleanup
To address @mikeharder's comment at #12737 (comment)