@@ -1032,13 +1032,13 @@ public IEnumerator<TItem> FindByPrimaryKeyPrefix<TItem>(in ReadOnlySpan<byte> ke
1032
1032
public TItem FirstByPrimaryKey < TItem > ( int loaderIndex , ConstraintInfo [ ] constraints , ICollection < TItem > target ,
1033
1033
IOrderer [ ] ? orderers , bool hasOrDefault ) where TItem : class
1034
1034
{
1035
- MemWriter keyBytes = new ( ) ;
1035
+ var keyBytes = MemWriter . CreateFromStackAllocatedSpan ( stackalloc byte [ 4096 ] ) ;
1036
1036
keyBytes . WriteBlock ( _relationInfo . Prefix ) ;
1037
1037
1038
1038
var relationVersionInfo = _relationInfo . ClientRelationVersionInfo ;
1039
1039
var primaryKeyFields = relationVersionInfo . PrimaryKeyFields . Span ;
1040
1040
1041
- Span < byte > buffer = stackalloc byte [ 1024 ] ;
1041
+ Span < byte > buffer = stackalloc byte [ 4096 ] ;
1042
1042
var writer = MemWriter . CreateFromStackAllocatedSpan ( buffer ) ;
1043
1043
if ( orderers == null || orderers . Length == 0 )
1044
1044
{
@@ -1085,12 +1085,11 @@ public TItem FirstByPrimaryKey<TItem>(int loaderIndex, ConstraintInfo[] constrai
1085
1085
public TItem FirstBySecondaryKey < TItem > ( int loaderIndex , ConstraintInfo [ ] constraints , uint secondaryKeyIndex ,
1086
1086
IOrderer [ ] ? orderers , bool hasOrDefault ) where TItem : class
1087
1087
{
1088
- var keyBytes = MemWriter . CreateFromStackAllocatedSpan ( stackalloc byte [ 16 ] ) ;
1088
+ var keyBytes = MemWriter . CreateFromStackAllocatedSpan ( stackalloc byte [ 4096 ] ) ;
1089
1089
keyBytes . WriteBlock ( _relationInfo . PrefixSecondary ) ;
1090
1090
var remappedSecondaryKeyIndex = RemapPrimeSK ( secondaryKeyIndex ) ;
1091
1091
keyBytes . WriteUInt8 ( ( byte ) remappedSecondaryKeyIndex ) ;
1092
- Span < byte > keyBuffer = stackalloc byte [ 4096 ] ;
1093
- var writer = MemWriter . CreateFromStackAllocatedSpan ( keyBuffer ) ;
1092
+ var writer = MemWriter . CreateFromStackAllocatedSpan ( stackalloc byte [ 4096 ] ) ;
1094
1093
if ( orderers == null || orderers . Length == 0 )
1095
1094
{
1096
1095
using var enumerator = new RelationConstraintSecondaryKeyEnumerator < TItem > ( _transaction , _relationInfo ,
@@ -1258,7 +1257,7 @@ public ulong GatherByPrimaryKey<TItem>(int loaderIndex, ConstraintInfo[] constra
1258
1257
skip = 0 ;
1259
1258
}
1260
1259
1261
- var writer = MemWriter . CreateFromStackAllocatedSpan ( stackalloc byte [ 1024 ] ) ;
1260
+ var writer = MemWriter . CreateFromStackAllocatedSpan ( stackalloc byte [ 4096 ] ) ;
1262
1261
var relationVersionInfo = _relationInfo . ClientRelationVersionInfo ;
1263
1262
var primaryKeyFields = relationVersionInfo . PrimaryKeyFields . Span ;
1264
1263
@@ -1363,7 +1362,7 @@ public ulong GatherBySecondaryKey<TItem>(int loaderIndex, ConstraintInfo[] const
1363
1362
1364
1363
var fastIteration = IsFastIterable ( constraints , constraints . Length ) ;
1365
1364
1366
- var writer = MemWriter . CreateFromStackAllocatedSpan ( stackalloc byte [ 1024 ] ) ;
1365
+ var writer = MemWriter . CreateFromStackAllocatedSpan ( stackalloc byte [ 4096 ] ) ;
1367
1366
if ( orderers == null || orderers . Length == 0 )
1368
1367
{
1369
1368
using var enumerator = new RelationConstraintSecondaryKeyEnumerator < TItem > ( _transaction , _relationInfo ,
0 commit comments