---
# System prepended metadata

title: Memory profiling of evm circuit

---

# Memory profiling of evm circuit

Using `time` for benching the maxium memory usage:

```shell=
/usr/bin/time -v target/release/deps/zkevm_circuits-c4b2265bb2943930 --nocapture --ignored bench_evm_circuit_prover

```

+ for reference, we bench state circuit first with DEGREE=20:

        Command being timed: "target/release/deps/zkevm_circuits-c4b2265bb2943930 bench_state_circuit_prover --nocapture"
        User time (seconds): 12431.26
        System time (seconds): 218.95
        Percent of CPU this job got: 1578%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 13:21.61
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 37301620
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 105193599
        Voluntary context switches: 616876
        Involuntary context switches: 42687
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0


+ then bench evm circuit with DEGREE=16

        Command being timed: "target/release/deps/zkevm_circuits-c4b2265bb2943930 --nocapture bench_evm_circuit_prover"
        User time (seconds): 6399.74
        System time (seconds): 823.01
        Percent of CPU this job got: 901%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 13:20.95
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 50736496
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 283349927
        Voluntary context switches: 5374169
        Involuntary context switches: 483201
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

+ DEGREE=16 with `include_large_table` set to false, no change

        Command being timed: "target/release/deps/zkevm_circuits-c4b2265bb2943930 --nocapture bench_evm_circuit_prover"
        User time (seconds): 3159.69
        System time (seconds): 468.74
        Percent of CPU this job got: 438%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 13:46.82
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 50735260
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 266386474
        Voluntary context switches: 1285457
        Involuntary context switches: 6252
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

+ DEGREE=16 with 8 threads for RAYCON, no change on memory usage

        Command being timed: "target/release/deps/zkevm_circuits-c4b2265bb2943930 --nocapture bench_evm_circuit_prover"
        User time (seconds): 2544.83
        System time (seconds): 459.23
        Percent of CPU this job got: 313%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 15:59.70
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 50745876
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 262471125
        Voluntary context switches: 679734
        Involuntary context switches: 4334
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

+ with DEGREE=17, 100GB ram being consumed so we can not bench larger degree (the host has only 196GB RAM)

        Command being timed: "target/release/deps/zkevm_circuits-c4b2265bb2943930 --nocapture bench_evm_circuit_prover"
        User time (seconds): 11969.11
        System time (seconds): 1279.58
        Percent of CPU this job got: 874%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 25:14.19
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 101404816
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 1
        Minor (reclaiming a frame) page faults: 548465099
        Voluntary context switches: 5455375
        Involuntary context switches: 382139
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0