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

Improve performance by removing dubious code #217

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

marc-vanderwal
Copy link
Contributor

Purpose

This PR improves the performance in Zonemaster::LDNS by removing undocumented code of dubious purpose.

The code in question has had a very long history and legacy. It survived over 10 years in the code base without much documentation of its purpose, either in code comments, documentation or commit messages. It is enabled only if the system Perl is compiled with support for interpreted threads, which introduces a difference in behavior that is system dependent.

The code might likely have been part of some debugging code paths so that a programmer could retrieve access to objects touched by LDNS. It stores all of these objects within a few hashes.

However, maintaining these hashes proves to be rather expensive. Disabling it speeds up simple runs of zonemaster-cli by roughly 3%, which is significant when Zonemaster is used to test millions of domains.

Context

Attempting to improve performance.

Changes

  • Delete all code added if USE_ITHREADS is defined.

How to test this PR

Unit tests should pass.

This commit removes code that has had a very long history and legacy. It
survived over 10 years in the code base without much documentation of
its purpose, either in code comments, documentation or commit messages.

It’s likely that it might have been part of some debugging code paths
that allow a programmer to retrieve access to objects touched by LDNS.
It stores all of these objects within a few hashes.

However, maintaining these hashes proves to be rather expensive.
Disabling it speeds up simple runs of zonemaster-cli by roughly 3%,
which is significant when Zonemaster is used to test millions of
domains.
@marc-vanderwal marc-vanderwal added the V-Patch Versioning: The change gives an update of patch in version. label Jan 22, 2025
@marc-vanderwal marc-vanderwal added this to the v2025.1 milestone Jan 22, 2025
tgreenx
tgreenx previously approved these changes Jan 28, 2025
@matsduf
Copy link
Contributor

matsduf commented Jan 28, 2025

#   Failed test 'make distcheck gives empty output'
#   at t/manifest.t line 36.
#          got: 'No such file: t/threads.t
# '
#     expected: ''
# Looks like you failed 1 test of 2.

Copy link
Contributor

@matsduf matsduf left a comment

Choose a reason for hiding this comment

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

MANIFEST must be updated first.

The unit test that this commit deletes tested the behavior of
Zonemaster::LDNS under interpreter threads.

But we never use interpreter threads in Zonemaster::Engine, so the test
exercises a situation that will never occur in practice. We can
therefore safely remove the file.
@marc-vanderwal
Copy link
Contributor Author

The failing unit test run by Travis (which runs them with TEST_WITH_NETWORK=1) is unrelated to the changes introduced by this PR. I have addressed that in another PR (see #218).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V-Patch Versioning: The change gives an update of patch in version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants