xapi-stdext-std: remove most functions, optimize escaping functions#6795
xapi-stdext-std: remove most functions, optimize escaping functions#6795psafont wants to merge 9 commits intoxapi-project:26.1-lcmfrom
Conversation
b897cff to
1b21740
Compare
|
I'll run some system tests on this and have a proper look throughout the day. |
|
Has |
1b21740 to
aebedca
Compare
|
Yes, from the message of the commit that introduces it (1174f3a): It can also be easily run with |
|
So I ran a test suite on the changes and unfortunately a few of the tests failed. Not sure what the best way to share the test results are, but here are some failure excerpts: XenLivePatchTest: Networking: HAOCx2WE: Let me know how you'd like to proceed/what info you need from me. |
|
It's difficult to say whether they are related just by looking at those loglines, and I haven't seen the test runs in months to remember well how they could affect the update guidances, or hosts failing to get online. Thanks for making the builds and running the tests, it's good to know most tests passed! (I guess the ring3BVT+BST) |
aebedca to
2dee6c2
Compare
|
It looks like the CI tests are not running; maybe restart them @psafont |
I don't see the controls to do it, unfortunately, I might have to create a new PR |
|
Can you rebase it? |
If I rebase it on master, I can't test it because XCP-ng 9 is still not ready. I'll rebase it once I've tested it better. |
2dee6c2 to
4865357
Compare
|
I've run quicktest, manually run some functionality using the change, and added more unit-tests for some of this functionality to convince myself that there are no unexpected surprises |
Users can instead opt for Astring.String's or stdlib's functions. Signed-off-by: Pau Ruiz Safont <[email protected]> Signed-off-by: Pau Ruiz Safont <[email protected]>
Also remove all indiscriminate opens against it Signed-off-by: Pau Ruiz Safont <[email protected]> Signed-off-by: Pau Ruiz Safont <[email protected]>
Signed-off-by: Pau Ruiz Safont <[email protected]> Signed-off-by: Pau Ruiz Safont <[email protected]>
String.replaced is an alias of map_unlikely. This names makes the intent
of the function clearer. Because a function to replace the characters is
exposed, users are less likely to fall into the pitfall of using lists.
Lists not only are very slow, but allow users to have more than one
replacement rule per character, possibly introducing mistakes.
If a plain match function cannot be produced and a list needs to be used,
users can convert it to a Char.Map and do the match with a find_opt.
This approach ends up being ~60-70% faster than using plain lists.
The benchmark comparing the new approach with the old one:
String size 100:
Optimized: 236.556 μs
Reference: 1861.600 μs
Improvement: 87.3% faster
String size 500:
Optimized: 1099.030 μs
Reference: 9665.405 μs
Improvement: 88.6% faster
String size 1000:
Optimized: 2198.777 μs
Reference: 19115.019 μs
Improvement: 88.5% faster
Signed-off-by: Pau Ruiz Safont <[email protected]>
Not only it's more efficient, but it's also more ergonomic Signed-off-by: Pau Ruiz Safont <[email protected]> Signed-off-by: Pau Ruiz Safont <[email protected]>
The former didn't have any tests and the performance is unknown Signed-off-by: Pau Ruiz Safont <[email protected]> Signed-off-by: Pau Ruiz Safont <[email protected]>
This also allows to drop String.isspace Signed-off-by: Pau Ruiz Safont <[email protected]> Signed-off-by: Pau Ruiz Safont <[email protected]>
I added some cases in preparation to change its implementation Signed-off-by: Pau Ruiz Safont <[email protected]>
The few users that needed to replace strings, have been replaced with Astring's cuts, as most of them were already segmenting strings, or they are run in very specific, infrequent codepaths for efficiency to not matter. Others have been replaced by Astring's filter as they were removing characters, and the rest have been converted to the new String.replace. map_unlikely can be removed from the interface and only have String.replaced and String.replace Signed-off-by: Pau Ruiz Safont <[email protected]> Signed-off-by: Pau Ruiz Safont <[email protected]>
4865357 to
75e79fb
Compare
The Listext module has a lot of baggage that can be replace with Stdlib, Astring. And what cannot be replaced, it can be made better, especially the escaping.
There are quite a few changes, so it's better to review commit-by-commit.
I need to do some testing to make sure all changes here are safe and undraft this