★ wanayoo — archive 1999 https://github.com/nodejs/node/pull/18398Nouvelle recherche | Portail wanayoo
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

lib,src: port isIPv4() to js #18398

Closed
wants to merge 2 commits into from
Closed

Conversation

Copy link
Member

@bnoordhuis bnoordhuis commented Jan 26, 2018

Removes a few lines of C++ code while making isIPv4() about 3x faster.
isIPv6() and isIP() for the IPv6 case stay about the same.

I removed the homegrown isIPv4() in lib/dns.js that utilized a lookup
table. It is in fact a little faster than the new isIPv4() function
but:

  1. the difference is only measurable at around 10M iterations, and
  2. the function is a "probably IPv4" heuristic, not a proper validator

bnoordhuis added 2 commits Jan 26, 2018
Removes a few lines of C++ code while making `isIPv4()` about 3x faster.
`isIPv6()` and `isIP()` for the IPv6 case stay about the same.

I removed the homegrown `isIPv4()` in lib/dns.js that utilized a lookup
table.  It is in fact a little faster than the new `isIPv4()` function
but:

1. the difference is only measurable at around 10M iterations, and
2. the function is a "probably IPv4" heuristic, not a proper validator
@nodejs-github-bot nodejs-github-bot added c++ lib / src labels Jan 26, 2018
@addaleax
Copy link
Member

@addaleax addaleax commented Jan 28, 2018

@addaleax addaleax added the author ready label Jan 28, 2018
@bnoordhuis bnoordhuis closed this Jan 29, 2018
bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Jan 29, 2018
PR-URL: nodejs#18398
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Jan 29, 2018
Removes a few lines of C++ code while making `isIPv4()` about 3x faster.
`isIPv6()` and `isIP()` for the IPv6 case stay about the same.

I removed the homegrown `isIPv4()` in lib/dns.js that utilized a lookup
table.  It is in fact a little faster than the new `isIPv4()` function
but:

1. The difference is only measurable at around 10M iterations, and
2. The function is a "probably IPv4" heuristic, not a proper validator.

PR-URL: nodejs#18398
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@bnoordhuis
Copy link
Member Author

@bnoordhuis bnoordhuis commented Jan 29, 2018

Landed in 98d1110...742ae61. Some infrastructural issues on the arm buildbots, everything else was green.

evanlucas pushed a commit that referenced this issue Jan 30, 2018
PR-URL: #18398
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@ChALkeR ChALkeR added the performance label Jan 31, 2018
@addaleax addaleax removed the author ready label Feb 4, 2018
@MylesBorins
Copy link
Member

@MylesBorins MylesBorins commented Feb 20, 2018

Should this be backported to v9.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

@MylesBorins MylesBorins added lts-watch-v6.x baking-for-lts labels Feb 27, 2018
@MylesBorins
Copy link
Member

@MylesBorins MylesBorins commented Feb 27, 2018

ping again re: backport to 9.x. this was only partially backported to an earlier release.

MayaLekova pushed a commit to MayaLekova/node that referenced this issue May 8, 2018
PR-URL: nodejs#18398
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
MayaLekova pushed a commit to MayaLekova/node that referenced this issue May 8, 2018
Removes a few lines of C++ code while making `isIPv4()` about 3x faster.
`isIPv6()` and `isIP()` for the IPv6 case stay about the same.

I removed the homegrown `isIPv4()` in lib/dns.js that utilized a lookup
table.  It is in fact a little faster than the new `isIPv4()` function
but:

1. The difference is only measurable at around 10M iterations, and
2. The function is a "probably IPv4" heuristic, not a proper validator.

PR-URL: nodejs#18398
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@MylesBorins MylesBorins removed the baking-for-lts label Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ lib / src performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants