Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

seriousme
Copy link
Contributor

I have updated all code to ES6 in two commits:

  • The first commit updates tests to ES6 to see if the tests would break in CI with the module still using pre-ES6 code
  • The second commit updates the rest of the module to ES6 including the benchmarks and code examples in the README.

All code, including examples in the README, has been converted using the ES5 to ES6 extension of Visual code and then checked by standard --fix.
(the code examples in the README were extracted to tempfiles, converted and pasted back)
I only did manual updates to code to make standard --fix succeed.

This process leaves room for further optimizations (e.g. creating javascript classes, removing some dependencies). I'm happy to try those as well but I thought I'd first do a most basic conversion and work from that.

In the README I also updated the Node versions tested in CI ;-)

Kind regards,
Hans

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

can you please check the benchmarks if there is a regression?

@seriousme
Copy link
Contributor Author

Well, there are lies, darn lies and benchmarks :-)

Lets look at CI results first: comparing the previous CI results listed as ES5 to the CI results for this PR listed as ES6

  Time in seconds    
Node version ES5 ES6 Difference
6 2,51 2,61 3,98%
8 2,01 2,31 14,93%
10 1,19 1,1 -7,56%
12 1,13 1,34 18,58%
14 1,02 1,24 21,57%

From this comparison we would be stupid to migrate from ES5 to ES6, but remember this is cloud and VM performance can vary quite some and Github does not promise any performance on its Actions :-(

It also does not make a lot of sense that the V8 team would be improving their performance for ES5 but not for ES6 nor that v10 would be way faster than v14 (the module is not that exotic imho).

So I redid the tests on my local machine (linux container on x86 chromebook). There are probably processes running in the background as well but the results are more stable and logical than from Github Actions:

  Time in seconds    
Node version ES5 ES6 Difference
6 7,19 7,2 0,14%
8 6,11 6,11 0,00%
10 4,54 4,69 3,30%
12 4,76 4,87 2,31%
14 4,91 4,84 -1,43%

Here it shows that the difference in performance is marginal as to be expected.

Running the same npm ci for ES6 on v14 5 times results in values between 4.82 and 4.97.

So my conclusion would be that the performance difference is minimal.
(and that benchmark results from testing on Github Actions should be handled with care ;-))

Kind regards,
Hans

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit dd3004d into mqttjs:master Aug 25, 2020
@seriousme seriousme deleted the es2015 branch August 25, 2020 15:04
@seriousme
Copy link
Contributor Author

FYI: This PR is a more recent version of #46 which can now also be closed imho.

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.

2 participants