Skip to content

Conversation

@nsajko
Copy link
Contributor

@nsajko nsajko commented Sep 8, 2025

As documented, the intended way to implement > is to add a method to <. Similarly with >=. A package should never add a method to either > or >=.

As documented, the intended way to implement `>` is to add a method to
`<`. Similarly with `>=`. A package should never add a method to either
`>` or `>=`.
@codecov
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.82%. Comparing base (7decc58) to head (15f0d80).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #771   +/-   ##
=======================================
  Coverage   89.82%   89.82%           
=======================================
  Files          11       11           
  Lines        1032     1032           
=======================================
  Hits          927      927           
  Misses        105      105           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nsajko nsajko marked this pull request as ready for review September 8, 2025 02:29
Copy link
Member

@devmotion devmotion left a comment

Choose a reason for hiding this comment

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

Good catch! The reason for these unnecessary definitions is that up until recently x < y for Dual numbers was not equivalent with !(x >= y). I fixed this in #695 but apparently did not clean up the code.

src/dual.jl Outdated
# BINARY_PREDICATES = Symbol[:isequal, :isless, :<, :>, :(==), :(!=), :(<=), :(>=)]
# Not a minimal set, as Base defines some in terms of others.
for pred in [:<, :>]
for pred in [:<]
Copy link
Member

Choose a reason for hiding this comment

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

With only a single element in pred, the loop and the @eval below are not needed anymore. Can you remove them?

@nsajko
Copy link
Contributor Author

nsajko commented Sep 8, 2025

This change decreases the unique invalidation count upon using ForwardDiff from 1504 to 784.

Instructions to reproduce this result:

  • Do @snoop_invalidations using ForwardDiff before loading any other package except for SnoopCompileCore. Not even the REPL or Pkg may be loaded before ForwardDiff, because they load StyledStrings, which does some piracy, causing invalidation, thus affecting the result.

  • Use nightly Julia v1.13, commit JuliaLang/julia@865b8be.

Data on each invalidation:

@devmotion devmotion merged commit 42e0aa6 into JuliaDiff:master Sep 8, 2025
12 checks passed
@nsajko nsajko deleted the prevent_adding_methods_fix branch September 8, 2025 17:12
@nsajko nsajko mentioned this pull request Sep 9, 2025
devmotion pushed a commit that referenced this pull request Sep 9, 2025
Release PRs #771 and #751.

Specifically I want a release because of the former, to cut down on
sysimage invalidation when loading ForwardDiff.
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