Skip to content

Conversation

@penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Nov 8, 2025

Performance gains in #1132 are only really significant when not using TSVI.

TSVI gets used more than it should (#1086).

This PR provides a mechanism to globally opt out of TSVI, in a way that is fully backwards-compatible.

Changing this to a global opt-in would just require changing the default to false.

A per-model opt-in would be doable too, albeit requiring more work. I think it's better to start from a global one and only consider a per-model one if people complain.

Performance

Edit: benchmarking this, I just realised that dereferencing USE_THREADSAFE_EVAL gives rise to more overhead than checking Threads.nthreads(). A per-model one should make this work better because if it's stored in the type, it can be removed at compile time. I'll investigate this further.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

Benchmark Report for Commit 6a0ecfa

Computer Information

Julia Version 1.11.7
Commit f2b3dbda30a (2025-09-08 12:10 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × AMD EPYC 7763 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

Benchmark Results

┌───────────────────────┬───────┬─────────────┬───────────────────┬────────┬────────────────┬─────────────────┐
│                 Model │   Dim │  AD Backend │           VarInfo │ Linked │ t(eval)/t(ref) │ t(grad)/t(eval) │
├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼────────────────┼─────────────────┤
│ Simple assume observe │     1 │ forwarddiff │             typed │  false │            7.5 │             1.7 │
│           Smorgasbord │   201 │ forwarddiff │             typed │  false │          757.0 │            43.8 │
│           Smorgasbord │   201 │ forwarddiff │ simple_namedtuple │   true │          436.1 │            55.2 │
│           Smorgasbord │   201 │ forwarddiff │           untyped │   true │          798.1 │            37.1 │
│           Smorgasbord │   201 │ forwarddiff │       simple_dict │   true │         7229.9 │            27.8 │
│           Smorgasbord │   201 │ forwarddiff │      typed_vector │   true │          776.1 │            42.4 │
│           Smorgasbord │   201 │ forwarddiff │    untyped_vector │   true │          795.6 │            37.9 │
│           Smorgasbord │   201 │ reversediff │             typed │   true │          920.4 │            45.5 │
│           Smorgasbord │   201 │    mooncake │             typed │   true │          734.1 │             6.0 │
│           Smorgasbord │   201 │      enzyme │             typed │   true │          919.1 │             4.0 │
│    Loop univariate 1k │  1000 │    mooncake │             typed │   true │         4035.9 │             5.7 │
│       Multivariate 1k │  1000 │    mooncake │             typed │   true │         1083.7 │             8.6 │
│   Loop univariate 10k │ 10000 │    mooncake │             typed │   true │        44505.8 │             5.4 │
│      Multivariate 10k │ 10000 │    mooncake │             typed │   true │         8929.4 │             9.9 │
│               Dynamic │    10 │    mooncake │             typed │   true │          130.1 │            13.0 │
│              Submodel │     1 │    mooncake │             typed │   true │            9.5 │            11.2 │
│                   LDA │    12 │ reversediff │             typed │   true │         1012.2 │             2.1 │
└───────────────────────┴───────┴─────────────┴───────────────────┴────────┴────────────────┴─────────────────┘

@codecov
Copy link

codecov bot commented Nov 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.69%. Comparing base (62a8746) to head (6a0ecfa).

Additional details and impacted files
@@            Coverage Diff             @@
##           py/ldf    #1128      +/-   ##
==========================================
+ Coverage   81.67%   81.69%   +0.01%     
==========================================
  Files          42       42              
  Lines        3919     3922       +3     
==========================================
+ Hits         3201     3204       +3     
  Misses        718      718              

☔ 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.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

DynamicPPL.jl documentation for PR #1128 is available at:
https://TuringLang.github.io/DynamicPPL.jl/previews/PR1128/

Base automatically changed from py/fastinit to py/fastldf November 10, 2025 19:28
@penelopeysm penelopeysm changed the base branch from py/fastldf to py/ldf November 12, 2025 12:15
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