Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FRI - Fast Reed-solomon Interactive oracle proof of proximity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dragoon
FRI - Fast Reed-solomon Interactive oracle proof of proximity
Commits
f92f8955
Commit
f92f8955
authored
11 months ago
by
j.detchart
Browse files
Options
Downloads
Patches
Plain Diff
start refactor frida benches
parent
87aa5b05
Branches
frida-bench-refactor
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
benches/frida.rs
+118
-2
118 additions, 2 deletions
benches/frida.rs
with
118 additions
and
2 deletions
benches/frida.rs
+
118
−
2
View file @
f92f8955
use
std
::
fmt
::
format
;
use
std
::
path
::
Path
;
use
ark_ff
::
PrimeField
;
use
ark_ff
::
{
FftField
,
PrimeField
}
;
use
ark_serialize
::
CanonicalSerialize
;
use
criterion
::{
black_box
,
criterion_group
,
criterion_main
,
BatchSize
,
BenchmarkId
,
Criterion
};
...
...
@@ -15,6 +16,8 @@ use fri_test_utils::{
random_file
,
Fq
,
BLOWUP_FACTOR
,
NUMBER_OF_POLYNOMIALS
,
NUM_QUERIES
,
POLY_COEFFS_LEN
,
};
use
rand
::{
thread_rng
,
Rng
};
use
rs_merkle
::
Hasher
;
use
fri
::
rng
::
ReseedableRng
;
/// Parameter to use as the input variable of a parametric bench
#[derive(Clone,
Copy,
PartialEq,
Eq,
Hash,
Debug,
Default)]
...
...
@@ -364,5 +367,118 @@ fn measure_frida(c: &mut Criterion) {
parametric_degree_bound_fixed_size
(
c
,
67_108_864
,
FOLDING_FACTOR
,
BLOWUP_FACTOR
,
NUM_QUERIES
);
}
criterion_group!
(
benches
,
measure_frida
);
fn
bench_frida
<
F
:
FftField
,
H
:
Hasher
,
R
:
ReseedableRng
<
Seed
=
H
::
Hash
>>
(
c
:
&
mut
Criterion
,
name
:
&
str
)
where
<
H
as
rs_merkle
::
Hasher
>
::
Hash
:
AsRef
<
[
u8
]
>
,
{
let
mut
group
=
c
.benchmark_group
(
name
);
let
k
=
4096
;
let
sz
=
4
*
1024
*
1024
;
//4MB
let
bf
=
4
;
let
q
=
32
;
let
file
=
random_file
::
<
Fq
>
(
k
,
sz
/
Fq
::
MODULUS_BIT_SIZE
as
usize
/
8
/
k
)
.into_iter
()
.map
(|
poly
|
to_evaluations
(
poly
,
k
*
bf
))
.collect
::
<
Vec
<
_
>>
();
for
log2_size
in
7
..
27
{
let
sz
=
2_usize
.pow
(
log2_size
);
group
.bench_with_input
(
format!
(
"Encode/{}-{}-{}"
,
sz
,
k
,
Fq
::
MODULUS_BIT_SIZE
),
&
sz
,
|
b
,
&
sz
|
{
b
.iter_batched
(
||
random_file
::
<
Fq
>
(
k
,
sz
/
Fq
::
MODULUS_BIT_SIZE
as
usize
/
8
/
k
),
|
file
|
{
file
.into_iter
()
.map
(|
poly
|
to_evaluations
(
poly
,
k
*
bf
))
.collect
::
<
Vec
<
_
>>
()
},
BatchSize
::
SmallInput
,
)
});
group
.bench_with_input
(
format!
(
"Prove/{}-{}-{}"
,
sz
,
k
,
Fq
::
MODULUS_BIT_SIZE
),
&
sz
,
|
b
,
&
sz
|
{
b
.iter_batched
(
||
random_file
::
<
Fq
>
(
k
,
sz
/
Fq
::
MODULUS_BIT_SIZE
as
usize
/
8
/
k
)
.into_iter
()
.map
(|
poly
|
to_evaluations
(
poly
,
k
*
bf
))
.collect
::
<
Vec
<
_
>>
(),
|
file
|
{
let
builder
=
FridaBuilder
::
<
F
,
H
>
::
new
::
<
4
,
_
>
(
&
file
,
FriChallenger
::
<
H
>
::
default
(),
bf
,
1
,
q
,
);
for
i
in
0
..
(
k
*
bf
)
{
black_box
(
builder
.prove_shards
(
&
[
i
]));
}
},
BatchSize
::
SmallInput
,
)
});
group
.bench_with_input
(
format!
(
"commit/{}-{}-{}"
,
sz
,
k
,
Fq
::
MODULUS_BIT_SIZE
),
&
sz
,
|
b
,
&
sz
|
{
b
.iter_batched
(
||
random_file
::
<
Fq
>
(
k
,
sz
/
Fq
::
MODULUS_BIT_SIZE
as
usize
/
8
/
k
)
.into_iter
()
.map
(|
poly
|
to_evaluations
(
poly
,
k
*
bf
))
.collect
::
<
Vec
<
_
>>
(),
|
file
|
{
let
builder
=
FridaBuilder
::
<
F
,
H
>
::
new
::
<
4
,
_
>
(
&
file
,
FriChallenger
::
<
H
>
::
default
(),
bf
,
1
,
q
,
);
FridaCommitment
::
from
(
builder
)
},
BatchSize
::
SmallInput
,
)
});
group
.bench_with_input
(
format!
(
"verify/{}-{}-{}"
,
sz
,
k
,
Fq
::
MODULUS_BIT_SIZE
),
&
sz
,
|
b
,
&
sz
|
{
b
.iter_batched
(
||
{
let
file
=
random_file
::
<
Fq
>
(
k
,
sz
/
Fq
::
MODULUS_BIT_SIZE
as
usize
/
8
/
k
)
.into_iter
()
.map
(|
poly
|
to_evaluations
(
poly
,
k
*
bf
))
.collect
::
<
Vec
<
_
>>
();
let
builder
=
FridaBuilder
::
<
F
,
H
>
::
new
::
<
4
,
_
>
(
&
file
,
FriChallenger
::
<
H
>
::
default
(),
bf
,
1
,
q
,
);
let
proofs
=
(
0
..
(
k
*
bf
))
.map
(|
i
|
builder
.prove_shards
(
&
[
i
]))
.collect
::
<
Vec
<
_
>>
();
(
FridaCommitment
::
from
(
builder
),
proofs
)
},
|(
commit
,
proofs
)|
{
commit
.verify
::
<
4
,
_
>
(
FriChallenger
::
<
H
>
::
default
(),
q
,
k
,
k
*
bf
)
.unwrap
()
},
BatchSize
::
SmallInput
,
)
});
}
group
.finish
();
}
fn
frida_bench
(
c
:
&
mut
Criterion
)
{
bench_frida
::
<
Fq
,
Blake3
,
FriChallenger
<
Blake3
>>
(
c
,
"frida"
);
}
// criterion_group!(benches, measure_frida);
criterion_group!
(
benches
,
frida_bench
);
criterion_main!
(
benches
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment