@@ -411,6 +411,66 @@ func ciphertextSwapRowsBenchmark<Scheme: HeScheme>(_: Scheme.Type) -> () -> Void
411411 }
412412}
413413
414+ // MARK: Serialization
415+
416+ func coeffPlaintextSerializeBenchmark< Scheme: HeScheme > ( _: Scheme . Type ) -> ( ) -> Void {
417+ {
418+ benchmark ( " CoeffPlaintextSerialize " , Scheme . self) { benchmark in
419+ let benchmarkContext : RlweBenchmarkContext < Scheme > = try StaticRlweBenchmarkContext . getBenchmarkContext ( )
420+ let plaintext = benchmarkContext. coeffPlaintext
421+ benchmark. startMeasurement ( )
422+ for _ in benchmark. scaledIterations {
423+ blackHole ( plaintext. serialize ( ) )
424+ }
425+ }
426+ }
427+ }
428+
429+ func evalPlaintextSerializeBenchmark< Scheme: HeScheme > ( _: Scheme . Type ) -> ( ) -> Void {
430+ {
431+ benchmark ( " EvalPlaintextSerialize " , Scheme . self) { benchmark in
432+ let benchmarkContext : RlweBenchmarkContext < Scheme > = try StaticRlweBenchmarkContext . getBenchmarkContext ( )
433+ let plaintext = benchmarkContext. evalPlaintext
434+ benchmark. startMeasurement ( )
435+ for _ in benchmark. scaledIterations {
436+ blackHole ( plaintext. serialize ( ) )
437+ }
438+ }
439+ }
440+ }
441+
442+ func coeffPlaintextDeserializeBenchmark< Scheme: HeScheme > ( _: Scheme . Type ) -> ( ) -> Void {
443+ {
444+ benchmark ( " CoeffPlaintextDeserialize " , Scheme . self) { benchmark in
445+ let benchmarkContext : RlweBenchmarkContext < Scheme > = try StaticRlweBenchmarkContext . getBenchmarkContext ( )
446+ let plaintext = benchmarkContext. coeffPlaintext
447+ let serialized = plaintext. serialize ( )
448+ benchmark. startMeasurement ( )
449+ for _ in benchmark. scaledIterations {
450+ try blackHole ( _ = Scheme . CoeffPlaintext (
451+ deserialize: serialized,
452+ context: benchmarkContext. context) )
453+ }
454+ }
455+ }
456+ }
457+
458+ func evalPlaintextDeserializeBenchmark< Scheme: HeScheme > ( _: Scheme . Type ) -> ( ) -> Void {
459+ {
460+ benchmark ( " EvalPlaintextDeserialize " , Scheme . self) { benchmark in
461+ let benchmarkContext : RlweBenchmarkContext < Scheme > = try StaticRlweBenchmarkContext . getBenchmarkContext ( )
462+ let plaintext = benchmarkContext. evalPlaintext
463+ let serialized = plaintext. serialize ( )
464+ benchmark. startMeasurement ( )
465+ for _ in benchmark. scaledIterations {
466+ try blackHole ( _ = Scheme . EvalPlaintext (
467+ deserialize: serialized,
468+ context: benchmarkContext. context) )
469+ }
470+ }
471+ }
472+ }
473+
414474func ciphertextSerializeFullBenchmark< Scheme: HeScheme > ( _: Scheme . Type ) -> ( ) -> Void {
415475 {
416476 benchmark ( " CiphertextSerializeFull " , Scheme . self) { benchmark in
@@ -553,6 +613,16 @@ nonisolated(unsafe) let benchmarks: () -> Void = {
553613 ciphertextSwapRowsBenchmark ( Bfv< UInt64> . self ) ( )
554614
555615 // Serialization
616+ coeffPlaintextSerializeBenchmark ( Bfv< UInt32> . self ) ( )
617+ coeffPlaintextSerializeBenchmark ( Bfv< UInt64> . self ) ( )
618+ evalPlaintextSerializeBenchmark ( Bfv< UInt32> . self ) ( )
619+ evalPlaintextSerializeBenchmark ( Bfv< UInt64> . self ) ( )
620+
621+ coeffPlaintextDeserializeBenchmark ( Bfv< UInt32> . self ) ( )
622+ coeffPlaintextDeserializeBenchmark ( Bfv< UInt64> . self ) ( )
623+ evalPlaintextDeserializeBenchmark ( Bfv< UInt32> . self ) ( )
624+ evalPlaintextDeserializeBenchmark ( Bfv< UInt64> . self ) ( )
625+
556626 ciphertextSerializeFullBenchmark ( Bfv< UInt32> . self ) ( )
557627 ciphertextSerializeFullBenchmark ( Bfv< UInt64> . self ) ( )
558628 ciphertextSerializeSeedBenchmark ( Bfv< UInt32> . self ) ( )
0 commit comments