Merged
Conversation
Speed up the TO_IP method by converting directly from utf-8 encoded strings to the ip encoding. Previously we did: ``` utf-8 -> String -> INetAddress -> ip encoding ``` In a step towards solving elastic#125460 this creates three IP parsing functions, one the rejects leading zeros, one that interprets leading zeros as decimal numbers, and one the interprets leading zeros as octal numbers. IPs have historically been parsed in all three of those ways. This plugs the "rejects leading zeros" parser into `TO_IP` because that's the behavior it had before. Here is the performance: ``` Benchmark Score Error Units leadingZerosAreDecimal 14.007 ± 0.093 ns/op leadingZerosAreOctal 15.020 ± 0.373 ns/op leadingZerosRejected 14.176 ± 3.861 ns/op original 32.950 ± 1.062 ns/op ``` So this is roughly 45% faster than what we had.
Collaborator
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Collaborator
|
Hi @nik9000, I've created a changelog YAML for you. |
…nto benchmark_instructions_jdk24
idegtiarenko
approved these changes
Apr 7, 2025
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
Member
Author
|
Note so we don't lose it: There's some talk about use SIMD to parse ipv4 addresses. They fit in a single SIMD register after all. The reading I did doesn't discuss leading zeros so that'd be fun! Anyway, I wanted something I could backport easily and our ways of directly accessing SIMD code didn't look super easy to backport at the moment, so I left it for later. |
Member
Author
Betrayal! |
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Apr 7, 2025
Speed up the TO_IP method by converting directly from utf-8 encoded strings to the ip encoding. Previously we did: ``` utf-8 -> String -> INetAddress -> ip encoding ``` In a step towards solving elastic#125460 this creates three IP parsing functions, one the rejects leading zeros, one that interprets leading zeros as decimal numbers, and one the interprets leading zeros as octal numbers. IPs have historically been parsed in all three of those ways. This plugs the "rejects leading zeros" parser into `TO_IP` because that's the behavior it had before. Here is the performance: ``` Benchmark Score Error Units leadingZerosAreDecimal 14.007 ± 0.093 ns/op leadingZerosAreOctal 15.020 ± 0.373 ns/op leadingZerosRejected 14.176 ± 3.861 ns/op original 32.950 ± 1.062 ns/op ``` So this is roughly 45% faster than what we had. This includes a big chunk of elastic#124676 - but not the behavior change - just the code that allowed it.
Member
Author
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Apr 7, 2025
Speed up the TO_IP method by converting directly from utf-8 encoded strings to the ip encoding. Previously we did: ``` utf-8 -> String -> INetAddress -> ip encoding ``` In a step towards solving elastic#125460 this creates three IP parsing functions, one the rejects leading zeros, one that interprets leading zeros as decimal numbers, and one the interprets leading zeros as octal numbers. IPs have historically been parsed in all three of those ways. This plugs the "rejects leading zeros" parser into `TO_IP` because that's the behavior it had before. Here is the performance: ``` Benchmark Score Error Units leadingZerosAreDecimal 14.007 ± 0.093 ns/op leadingZerosAreOctal 15.020 ± 0.373 ns/op leadingZerosRejected 14.176 ± 3.861 ns/op original 32.950 ± 1.062 ns/op ``` So this is roughly 45% faster than what we had. This includes a big chunk of elastic#124676 - but not the behavior change - just the code that allowed it.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Apr 7, 2025
Speed up the TO_IP method by converting directly from utf-8 encoded strings to the ip encoding. Previously we did: ``` utf-8 -> String -> INetAddress -> ip encoding ``` In a step towards solving #125460 this creates three IP parsing functions, one the rejects leading zeros, one that interprets leading zeros as decimal numbers, and one the interprets leading zeros as octal numbers. IPs have historically been parsed in all three of those ways. This plugs the "rejects leading zeros" parser into `TO_IP` because that's the behavior it had before. Here is the performance: ``` Benchmark Score Error Units leadingZerosAreDecimal 14.007 ± 0.093 ns/op leadingZerosAreOctal 15.020 ± 0.373 ns/op leadingZerosRejected 14.176 ± 3.861 ns/op original 32.950 ± 1.062 ns/op ``` So this is roughly 45% faster than what we had. This includes a big chunk of #124676 - but not the behavior change - just the code that allowed it.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Apr 7, 2025
Speed up the TO_IP method by converting directly from utf-8 encoded strings to the ip encoding. Previously we did: ``` utf-8 -> String -> INetAddress -> ip encoding ``` In a step towards solving #125460 this creates three IP parsing functions, one the rejects leading zeros, one that interprets leading zeros as decimal numbers, and one the interprets leading zeros as octal numbers. IPs have historically been parsed in all three of those ways. This plugs the "rejects leading zeros" parser into `TO_IP` because that's the behavior it had before. Here is the performance: ``` Benchmark Score Error Units leadingZerosAreDecimal 14.007 ± 0.093 ns/op leadingZerosAreOctal 15.020 ± 0.373 ns/op leadingZerosRejected 14.176 ± 3.861 ns/op original 32.950 ± 1.062 ns/op ``` So this is roughly 45% faster than what we had. This includes a big chunk of #124676 - but not the behavior change - just the code that allowed it.
Member
Author
|
Backports in. |
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Apr 29, 2025
I wrote an `&&` when I meant and `||` in elastic#126338 and that caused some impressive looking line noise to parse as valid ipv4 addresses. Randomized tests caught it eventually.
nik9000
added a commit
that referenced
this pull request
Apr 29, 2025
I wrote an `&&` when I meant and `||` in #126338 and that caused some impressive looking line noise to parse as valid ipv4 addresses. Randomized tests caught it eventually.
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Apr 29, 2025
I wrote an `&&` when I meant and `||` in elastic#126338 and that caused some impressive looking line noise to parse as valid ipv4 addresses. Randomized tests caught it eventually.
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Apr 29, 2025
I wrote an `&&` when I meant and `||` in elastic#126338 and that caused some impressive looking line noise to parse as valid ipv4 addresses. Randomized tests caught it eventually.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Apr 29, 2025
elasticsearchmachine
pushed a commit
that referenced
this pull request
Apr 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Speed up the TO_IP method by converting directly from utf-8 encoded strings to the ip encoding. Previously we did:
In a step towards solving #125460 this creates three IP parsing functions, one the rejects leading zeros, one that interprets leading zeros as decimal numbers, and one the interprets leading zeros as octal numbers. IPs have historically been parsed in all three of those ways.
This plugs the "rejects leading zeros" parser into
TO_IPbecause that's the behavior it had before.Here is the performance:
So this is roughly 45% faster than what we had.