Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
439f2abe
Commit
439f2abe
authored
Jan 27, 2026
by
Luke Sandberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a different configuration for hashing, no varints
parent
444a4263
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
11 deletions
+24
-11
lib.rs
turbopack/crates/turbo-bincode/src/lib.rs
+16
-2
kv_backing_storage.rs
...pack/crates/turbo-tasks-backend/src/kv_backing_storage.rs
+8
-9
No files found.
turbopack/crates/turbo-bincode/src/lib.rs
View file @
439f2abe
...
...
@@ -14,6 +14,13 @@ use bincode::{
use
turbo_tasks_hash
::
DeterministicHasher
;
pub
const
TURBO_BINCODE_CONFIG
:
bincode
::
config
::
Configuration
=
bincode
::
config
::
standard
();
/// Same as standard config, but since we aren't encoding we don't benefit from varint
/// optimizations.
pub
const
TURBO_BINCODE_HASH_CONFIG
:
bincode
::
config
::
Configuration
<
bincode
::
config
::
LittleEndian
,
bincode
::
config
::
Fixint
,
bincode
::
config
::
NoLimit
,
>
=
TURBO_BINCODE_CONFIG
.with_fixed_int_encoding
();
pub
type
TurboBincodeBuffer
=
SmallVec
<
[
u8
;
16
]
>
;
pub
type
TurboBincodeEncoder
<
'a
>
=
EncoderImpl
<
TurboBincodeWriter
<
'a
>
,
bincode
::
config
::
Configuration
>
;
...
...
@@ -144,13 +151,20 @@ impl<H: DeterministicHasher + ?Sized> Writer for HashWriter<'_, H> {
}
/// An encoder that writes directly to a [`DeterministicHasher`].
pub
type
HashEncoder
<
'a
,
H
>
=
EncoderImpl
<
HashWriter
<
'a
,
H
>
,
bincode
::
config
::
Configuration
>
;
pub
type
HashEncoder
<
'a
,
H
>
=
EncoderImpl
<
HashWriter
<
'a
,
H
>
,
bincode
::
config
::
Configuration
<
bincode
::
config
::
LittleEndian
,
bincode
::
config
::
Fixint
,
bincode
::
config
::
NoLimit
,
>
,
>
;
/// Creates a new [`HashEncoder`] that encodes directly to the given hasher.
///
/// This is useful for computing hashes of encoded values without allocating a buffer.
pub
fn
new_hash_encoder
<
H
:
DeterministicHasher
+
?
Sized
>
(
hasher
:
&
mut
H
)
->
HashEncoder
<
'_
,
H
>
{
EncoderImpl
::
new
(
HashWriter
::
new
(
hasher
),
TURBO_BINCODE_CONFIG
)
EncoderImpl
::
new
(
HashWriter
::
new
(
hasher
),
TURBO_BINCODE_
HASH_
CONFIG
)
}
/// Represents a type that can only be encoded with a [`TurboBincodeEncoder`].
...
...
turbopack/crates/turbo-tasks-backend/src/kv_backing_storage.rs
View file @
439f2abe
...
...
@@ -374,7 +374,6 @@ impl<T: KeyValueDatabase + Send + Sync + 'static> BackingStorageSealed
items
=
task_cache_updates
.iter
()
.map
(|
m
|
m
.len
())
.sum
::
<
usize
>
()
)
.entered
();
for
(
task_type
,
task_id
)
in
task_cache_updates
.into_iter
()
.flatten
()
{
let
hash
=
compute_task_type_hash
(
&
task_type
);
let
task_id
=
*
task_id
;
...
...
@@ -423,15 +422,15 @@ impl<T: KeyValueDatabase + Send + Sync + 'static> BackingStorageSealed
task_type
:
&
CachedTaskType
,
)
->
Result
<
SmallVec
<
[
TaskId
;
1
]
>>
{
let
hash
=
compute_task_type_hash
(
task_type
);
let
result
s
=
database
.get_multiple
(
tx
,
KeySpace
::
TaskCache
,
&
hash
.to_le_bytes
())
?
;
let
buffer
s
=
database
.get_multiple
(
tx
,
KeySpace
::
TaskCache
,
&
hash
.to_le_bytes
())
?
;
Ok
(
results
.iter
()
.map
(|
bytes
|
{
let
as_array
=
bytes
.borrow
()
.try_into
(
)
.unwrap
();
TaskId
::
try_from
(
u32
::
from_le_bytes
(
as_array
))
.unwrap
()
})
.collect
()
)
let
mut
task_ids
=
SmallVec
::
with_capacity
(
buffers
.len
());
for
bytes
in
buffers
{
let
bytes
=
bytes
.borrow
()
.try_into
()
?
;
let
id
=
TaskId
::
try_from
(
u32
::
from_le_bytes
(
bytes
)
)
.unwrap
();
task_ids
.push
(
id
);
}
Ok
(
task_ids
)
}
if
inner
.database
.is_empty
()
{
// Checking if the database is empty is a performance optimization
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment