Tl.Runtime 0.6.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Tl.Runtime --version 0.6.0
                    
NuGet\Install-Package Tl.Runtime -Version 0.6.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tl.Runtime" Version="0.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tl.Runtime" Version="0.6.0" />
                    
Directory.Packages.props
<PackageReference Include="Tl.Runtime" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tl.Runtime --version 0.6.0
                    
#r "nuget: Tl.Runtime, 0.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Tl.Runtime@0.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tl.Runtime&version=0.6.0
                    
Install as a Cake Addin
#tool nuget:?package=Tl.Runtime&version=0.6.0
                    
Install as a Cake Tool

tl

tl compiles authored tracks and clips into direct C# playback kernels. It also provides an unmanaged runtime interpreter for timelines created from data at run time. Both paths use the same typed consumer contract and preserve the same playback semantics.

Status: v0.6. The runtime and generator target .NET 10 and are verified under JIT and NativeAOT. The library source footprint is 178,299 of 200,000 bytes including relative paths.

Packages

Package Version Purpose
Tl.Runtime 0.6.0 Authoring, unmanaged runtime storage, playback, and typed operations.
Tl.Gen 0.6.0 Build-time C# timeline compiler and deterministic output cache.

Compiled timeline

Declare one named partial value type. Define is the complete authoring program.

using Tl;

namespace Game;

public readonly record struct HealthClip(float Amount);

public readonly struct HealthTrack : IBlend<HealthClip>
{
    public void Blend(in HealthClip first, in HealthClip second, float t, out HealthClip result)
        => result = new(first.Amount + (second.Amount - first.Amount) * t);
}

public readonly partial struct HealthTimeline : ITimeline<HealthTrack, HealthClip>
{
    public static void Define(scoped TimelineBuilder<HealthTrack, HealthClip> timeline)
    {
        var health = timeline.Track(new HealthTrack());
        timeline.Clip(in health, new HealthClip(2f), 0u, 4u);
    }
}

Include the declaration in the generator input:

<ItemGroup>
  <PackageReference Include="Tl.Runtime" Version="0.6.0" />
  <PackageReference Include="Tl.Gen" Version="0.6.0" PrivateAssets="all" />
  <TlCompileTimeline Include="HealthTimeline.cs" />
</ItemGroup>

The build emits the other half of HealthTimeline. Application code calls the named type directly:

var input = new HealthInput(100f);
var result = new HealthResult { Value = input.Seed };
var playback = HealthTimeline.Start();
playback = HealthTimeline.Forward(in playback, in input, ref result, 0u, 1u, 2u, 3u);
playback = HealthTimeline.Stop(in playback);

An unchanged source set is a generation-cache hit. Identical output keeps its timestamp. Deleted declarations remove only generator-owned unchanged files. A project containing only named partial timelines receives no legacy compatibility source.

Consumer contract

ITrack receives one resolved active track at a time. It replaces the former Tracks<TTrack,TClip> view and the separate compiled callback API.

public readonly record struct HealthInput(float Seed);

public struct HealthResult : ITrack<HealthTrack, HealthClip, HealthInput, HealthResult>
{
    public float Value;

    public static void Forward(
        int ordinal,
        int count,
        ushort index,
        in HealthTrack track,
        in HealthClip clip,
        ClipState state,
        in uint tick,
        in HealthInput input,
        ref HealthResult result)
        => result.Value += state == ClipState.Stay ? clip.Amount : 0f;

    public static void Backward(
        int ordinal,
        int count,
        ushort index,
        in HealthTrack track,
        in HealthClip clip,
        ClipState state,
        in uint tick,
        in HealthInput input,
        ref HealthResult result)
        => result.Value -= state == ClipState.Stay ? clip.Amount : 0f;
}

ordinal is the work position in the destination tick, count is the number of active works, and index is the authored track index. track and clip are typed values. state is Enter, Stay, or Exit. Input is read-only; result is caller-owned mutable state. ordinal == 0 and ordinal == count - 1 replace begin/end logic from the former per-tick callback. IForward and IBackward remain available for direction-specific generic constraints; ITrack combines them.

The compiler specializes direction, loop behavior, region selection, work count, track and clip identity, blend shape, movement state, and payload access. The generated scalar entry point stays scalar. Batch methods retain playback locals across the span. Static abstract calls allow the JIT and NativeAOT compiler to inline the closed consumer operation into the generated kernel.

Runtime-authored timeline

Use the interpreter when the timeline data is unavailable at build time:

ushort id = Timeline<HealthTrack, HealthClip>.Build(HealthTimeline.Define).InMemory();
Timeline<HealthTrack, HealthClip>.Bind<HealthInput, HealthResult>(id);

var playback = Timeline.Start(id);
playback = Timeline.Forward(id, in playback, in input, ref result, 0u);
playback = Timeline.Stop(id, in playback);
Timeline.Destroy(id);

.InMemory() lowers the authored graph into one explicitly owned native block. It contains region data, work slots, unmanaged track and clip payloads, and native binding slots. Playback is read-only over that immutable snapshot and allocates zero managed bytes after binding. Destroy must run exactly once and must not race playback. Handles are process-local and never reused.

TTrack and TClip are constrained to unmanaged. Playback, Cursor, and generated timeline state contain no managed references. TInput and TResult are caller-owned and may also be unmanaged ECS components; the runtime never retains either value. Unity Burst remains a separate toolchain qualification because it does not implement the complete .NET 10 runtime surface.

Measured result

BenchmarkDotNet v0.15.8, .NET 10.0.11, x64 RyuJIT x86-64-v3, i9-14900K, 16 warmups, 12 measured iterations, 250 ms per iteration:

Operation Runtime interpreter Compiled kernel Speedup
Full consumer, scalar 15.340 ns 4.489 ns 3.42x
Full consumer, batch 8 11.231 ns 4.104 ns 2.74x
Sum consumer, scalar 11.157 ns 2.473 ns 4.51x

Every arm reported zero managed allocation. Each invocation starts from fresh state, consumes a fixed tick sequence, returns the complete playback and consumer receipt, and checks interpreter/compiled parity during setup. The earlier exact-consumer research kernel remains useful evidence: predictable batches reached 1.195–1.344 ns/tick. The production kernel preserves arbitrary typed ITrack behavior and currently lands at about 2.5 ns for a minimal consumer and 4.5 ns for the full receipt consumer. See the design report for the physical floor, rejected approaches, and the next specialization tiers.

Semantics

  • Ticks are uint; clip windows are half-open [start, end).
  • A track may have at most two simultaneous clips. A pair is blended once per work.
  • Work is delivered in authored track order.
  • Empty destinations invoke no consumer operation.
  • A large jump samples the destination and movement facts; it does not replay every crossed clip.
  • Playback is 8 bytes and caller-owned.
  • Compiled and interpreted paths are bit-exact for the same authored timeline and consumer.
  • Callback effects before an exception remain observable.

The detailed contract is in the semantics reference. The release changes and evidence are in the v0.6 notes.

Verification

dotnet build tl.slnx -c Release --no-restore -m:1
dotnet test tl.slnx -c Release --no-build --no-restore -m:1
dotnet run --project samples/Compiled -c Release --no-build
dotnet run --project benchmarks/Dispatch -c Release --no-build -- --verify
dotnet run --project benchmarks/Algorithms -c Release --no-build -- --verify
dotnet publish samples/Compiled/Compiled.csproj -c Release -r linux-x64 --self-contained true -p:PublishAot=true

Historical release notes and benchmark artifacts remain under docs/ and benchmarks/. They describe the API and hypotheses at the commit where each result was measured.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Tl.Runtime:

Package Downloads
Tl.CSharp

One-package C# installation: tl runtime plus the build-time consumer binding generator.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.0-preview.1 63 11/6/2026
3.0.0 783 10/3/2026
2.0.1 200 10/1/2026
2.0.0 121 10/1/2026
1.3.0 495 9/28/2026
1.2.0 137 9/24/2026
1.1.0 144 9/21/2026
1.0.0 142 9/21/2026
1.0.0-alpha.10 242 9/19/2026
1.0.0-alpha.9 120 9/18/2026
1.0.0-alpha.8 130 9/17/2026
1.0.0-alpha.7 137 9/17/2026
1.0.0-alpha.6 127 9/14/2026
1.0.0-alpha.5 122 9/13/2026
1.0.0-alpha.4 90 9/13/2026
0.6.0 148 9/9/2026
0.5.0 133 9/8/2026
0.1.0 173 9/7/2026

v0.6.0: one static ITrack operation per resolved work, unmanaged timeline storage, zero-allocation playback, and interpreter/generated parity under JIT and NativeAOT. https://github.com/IAFahim/tl/releases/tag/v0.6.0