-
-
Notifications
You must be signed in to change notification settings - Fork 639
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
feat: route()
with one argument is renamed basePath()
.
#964
Conversation
Hi @yusukebe ! I have created a PR that adds |
Great work! You're right, I think we should leave One thing about I have not used import { run, bench } from 'mitata'
class Sharp {
#prop = true
setProp() {
this.#prop = true
}
}
class Private {
private prop = true
setProp() {
this.prop = true
}
}
const withSharp = () => {
const foo = new Sharp()
foo.setProp()
}
const withPrivate = () => {
const foo = new Private()
foo.setProp()
}
{
bench('sharp', async () => {
withSharp()
})
}
{
bench('private', async () => {
withPrivate()
})
}
await run() Result:
So I thought it was better not to use |
dd59dcd
to
b07234b
Compare
@yusukebe Updated! sharp vs. privateIndeed, with your script, "private" also won in my environment.
However, when I swapped the order of execution as follows ... import { run, bench } from 'mitata'
class Sharp {
#prop = true
setProp() {
this.#prop = true
}
}
class Private {
private prop = true
setProp() {
this.prop = true
}
}
const withSharp = () => {
const foo = new Sharp()
foo.setProp()
}
const withPrivate = () => {
const foo = new Private()
foo.setProp()
}
{
bench('private', async () => {
withPrivate()
})
}
{
bench('sharp', async () => {
withSharp()
})
}
await run() The results were also swapped.
I have yet to check all of them, but there is no difference in a modern execution environment. However, I have some misgivings, so I agree with the |
Wow, it's right. In my environment also, the results are swapped:
Indeed, I know sometimes the results are swapped in the order of the benchmarks. Thanks for letting me know. Nevertheless, let's deal with |
Okay, I'll merge it now! |
#948 basePath() version
One difference from #948 (comment) is that we replaced
private _basePath
with#basePath
. This should make it more straightforward that it is a local member.Compatibility
To reduce confusion caused by compatibility issues, it would be possible to allow
route(path)
to be used in 3.x and then remove it in 4.x.