Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageVersion Include="FSharp.Core" Version="9.0.100" />
<PackageVersion Include="FSharp.SystemTextJson" Version="1.3.13" />
<PackageVersion Include="JasperFx" Version="1.27.0" />
<PackageVersion Include="JasperFx.Events" Version="1.29.1" />
<PackageVersion Include="JasperFx.Events" Version="1.30.0" />
<PackageVersion Include="JasperFx.Events.SourceGenerator" Version="1.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
27 changes: 24 additions & 3 deletions src/Marten/Events/EventGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,31 @@ internal void Initialize(DocumentStore store)


_tombstones = new RetryBlock<UpdateBatch>(executeTombstoneBlock, logger, _cancellation.Token);
foreach (var mapping in _events)

// Pre-warm name->type so the first read of each event type from the database
// doesn't fall through Type.GetType(assemblyQualifiedName) in TypeForDotNetName,
// which is itself O(loaded-assemblies). Populate both AssemblyQualifiedName and
// FullName since both shapes appear in event metadata over the lifetime of a
// store. Done as a single Swap so we don't churn ImHashMap.
_nameToType.Swap(map =>
{
mapping.JsonTransformation(null);
}
foreach (var mapping in _events)
{
mapping.JsonTransformation(null);

var docType = mapping.DocumentType;
if (docType.AssemblyQualifiedName is { } aqn)
{
map = map.AddOrUpdate(aqn, docType);
}
if (docType.FullName is { } fullName)
{
map = map.AddOrUpdate(fullName, docType);
}
}

return map;
});

autoDiscoverTagTypesFromProjections();
}
Expand Down
Loading