-
Notifications
You must be signed in to change notification settings - Fork 223
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
Make the point that compatibility-mode=base
is a lot less useful now
#794
Comments
One thing to note, this page is already hidden from the sidebar. Maybe we can just delete it? 🙂 What would the consequence be? |
It is still a feature of k6 and you can enable it ... I am also pretty certain it is linked from a lot places. So we should probably update it to tell the users that it is no longer needed more than anything else. |
But what if we just:
Do you see any problem with this? The only possible issues I foresee:
|
I don't think we should cram this in the options section, that seems like it will make things worse 🤔 We don't want to hide In fact, we should probably have a new "JavaScript compatibility" docs page with:
|
History
At the time
--compatibility-mode=
was added, with possible values ofbase
andextented
, k6 was using both babel and core.js v2 internally to "extend" what js k6 could run.Since then we have completely dropped core.js which was arguably the biggest contributter ro making
compatibilty-mode=base
perform a lot better. It both dropped 2mb+ of memory per VU, but also removed the need for each VU to run 84kb of minified js code. That was taking considerably enough time, that when we removed it suddenly k6 VUS were starting really faster.Since then we have also dropped almost everything else that babel is used except for ecmascript module support (import/export syntax ++). This is likely to change soon ™️ see grafana/k6#2563
Problem
But users keep going for using
--compatibility-mode=base
as a way to optimize their scripts, which usually requires them to:And at the end they usually get nothing in return except for a harder setup :(.
Given this I think it's good idea to start recommending people to not make their scripts
--compatibility-mode=base
if they want more performance as that will just not work.Caveats
--compatibilty-mode=base
will still be useful until we completely remove babel if the users have particuarly big scripts and them going through our babel is time consuming. This usually happens with scripts that have combined length of over 10k lines[citation needed]. Given also that we are likely to have this if not in v0.41.0 then in v0.42.0, it might still be worth it to start telling people to not go through the trouble for this.typescript
. This is why https://github.com/grafana/k6-template-es6 and https://github.com/grafana/k6-template-typescript/ exists. But they both should probably be updated to not go to commonjs but instead still use ESM after support for it is added in k6.Proposed solution:
--compatibility-mode=extented
actually still extends - this is now pretty short, it addsglobal
as alias toglobaThis
and adds support for ESM as it runs the code through babel (This is as of v0.40.0 which did add class support).The text was updated successfully, but these errors were encountered: