Skip to content

a benchmark of a PlutusTx and Aiken implementation of the bls12-381 fields

License

Notifications You must be signed in to change notification settings

perturbing/mod-exp-bench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mod-exp-bench

a benchmark of a PlutusTx implementation of the bls12-381 fields against different operations. Note that the cost model is against a fork of plutus which uses a preliminary cost model for the new plutus base machine.

benchmarks

Scalars Field Operations (mod q) FP Field Operations (mod p)
n scalars field additions (size 32 bytes mod q)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0      97   (0.6%)          897100   (0.0%)            4000   (0.0%) 
   10     507   (3.1%)        15143830   (0.2%)           37060   (0.3%) 
   20     919   (5.6%)        29390560   (0.3%)           70120   (0.5%) 
   30    1330   (8.1%)        43637290   (0.4%)          103180   (0.7%) 
   40    1742  (10.6%)        57884020   (0.6%)          136240   (1.0%) 
   50    2154  (13.1%)        72130750   (0.7%)          169300   (1.2%) 
   60    2560  (15.6%)        86377480   (0.9%)          202360   (1.4%) 
   70    2973  (18.1%)       100624210   (1.0%)          235420   (1.7%) 
   80    3386  (20.7%)       114870940   (1.1%)          268480   (1.9%) 
   90    3793  (23.2%)       129117670   (1.3%)          301540   (2.2%) 
  100    4210  (25.7%)       143364400   (1.4%)          334600   (2.4%) 


n scalars field multiplications (size 32 bytes mod q)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0      97   (0.6%)          897100   (0.0%)            4000   (0.0%) 
   10     507   (3.1%)        14681499   (0.1%)           37114   (0.3%) 
   20     916   (5.6%)        28504479   (0.3%)           70234   (0.5%) 
   30    1333   (8.1%)        42327459   (0.4%)          103354   (0.7%) 
   40    1743  (10.6%)        56150439   (0.6%)          136474   (1.0%) 
   50    2149  (13.1%)        69973419   (0.7%)          169594   (1.2%) 
   60    2560  (15.6%)        83796399   (0.8%)          202714   (1.4%) 
   70    2974  (18.2%)        97619379   (1.0%)          235834   (1.7%) 
   80    3387  (20.7%)       111442359   (1.1%)          268954   (1.9%) 
   90    3792  (23.1%)       125265339   (1.3%)          302074   (2.2%) 
  100    4208  (25.7%)       139088319   (1.4%)          335194   (2.4%) 


n scalars field exponentiations via bitshifts (size 32 bytes mod q)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     207   (1.3%)         1518100   (0.0%)            6700   (0.0%) 
    1     248   (1.5%)       895988153   (9.0%)         1789666  (12.8%) 
    2     288   (1.8%)      1790458206  (17.9%)         3572632  (25.5%) 
    3     331   (2.0%)      2684928259  (26.8%)         5355598  (38.3%) 
    4     372   (2.3%)      3579398312  (35.8%)         7138564  (51.0%) 
    5     413   (2.5%)      4473868365  (44.7%)         8921530  (63.7%) 
    6     453   (2.8%)      5368338418  (53.7%)        10704496  (76.5%) 
    7     494   (3.0%)      6262808471  (62.6%)        12487462  (89.2%) 
    8     536   (3.3%)      7157278524  (71.6%)        14270428 (101.9%) 
    9     573   (3.5%)      8051748577  (80.5%)        16053394 (114.7%) 
   10     618   (3.8%)      8946218630  (89.5%)        17836360 (127.4%) 


n scalars field exponentiations via powMod (size 32 bytes mod q)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     237   (1.4%)         1449100   (0.0%)            6400   (0.0%) 
    1     278   (1.7%)      1207711984  (12.1%)         2003368  (14.3%) 
    2     320   (2.0%)      2413974868  (24.1%)         4000336  (28.6%) 
    3     361   (2.2%)      3620237752  (36.2%)         5997304  (42.8%) 
    4     400   (2.4%)      4826500636  (48.3%)         7994272  (57.1%) 
    5     441   (2.7%)      6032763520  (60.3%)         9991240  (71.4%) 
    6     483   (2.9%)      7239026404  (72.4%)        11988208  (85.6%) 
    7     523   (3.2%)      8445289288  (84.5%)        13985176  (99.9%) 
    8     566   (3.5%)      9651552172  (96.5%)        15982144 (114.2%) 
    9     605   (3.7%)     10857815056 (108.6%)        17979112 (128.4%) 
   10     647   (3.9%)     12064077940 (120.6%)        19976080 (142.7%) 


n scalars field inversion via ext euclidean algo(size 32 bytes mod q)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     235   (1.4%)         1449100   (0.0%)            6400   (0.0%) 
    1     277   (1.7%)       466954197   (4.7%)         1092348   (7.8%) 
    2     318   (1.9%)      1001337219  (10.0%)         2338168  (16.7%) 
    3     358   (2.2%)      1424332447  (14.2%)         3325163  (23.8%) 
    4     399   (2.4%)      1948380516  (19.5%)         4548078  (32.5%) 
    5     441   (2.7%)      2463648027  (24.6%)         5748298  (41.1%) 
    6     483   (2.9%)      3043206903  (30.4%)         7100603  (50.7%) 
    7     522   (3.2%)      3414387173  (34.1%)         7965882  (56.9%) 
    8     563   (3.4%)      3863175007  (38.6%)         9013716  (64.4%) 
    9     603   (3.7%)      4266968333  (42.7%)         9955103  (71.1%) 
   10     646   (3.9%)      4970209051  (49.7%)        11596565  (82.8%) 
n fp field additions (size 48 bytes mod p)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     115   (0.7%)          897100   (0.0%)            4000   (0.0%) 
   10     706   (4.3%)        15204070   (0.2%)           37080   (0.3%) 
   20    1297   (7.9%)        29511040   (0.3%)           70160   (0.5%) 
   30    1891  (11.5%)        43818010   (0.4%)          103240   (0.7%) 
   40    2483  (15.2%)        58124980   (0.6%)          136320   (1.0%) 
   50    3075  (18.8%)        72431950   (0.7%)          169400   (1.2%) 
   60    3666  (22.4%)        86738920   (0.9%)          202480   (1.4%) 
   70    4255  (26.0%)       101045890   (1.0%)          235560   (1.7%) 
   80    4847  (29.6%)       115352860   (1.2%)          268640   (1.9%) 
   90    5438  (33.2%)       129659830   (1.3%)          301720   (2.2%) 
  100    6032  (36.8%)       143966800   (1.4%)          334800   (2.4%) 


n fp field multiplications (size 48 bytes mod p)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     115   (0.7%)          897100   (0.0%)            4000   (0.0%) 
   10     705   (4.3%)        15209205   (0.2%)           37170   (0.3%) 
   20    1300   (7.9%)        29587665   (0.3%)           70350   (0.5%) 
   30    1890  (11.5%)        43966125   (0.4%)          103530   (0.7%) 
   40    2483  (15.2%)        58344585   (0.6%)          136710   (1.0%) 
   50    3074  (18.8%)        72723045   (0.7%)          169890   (1.2%) 
   60    3665  (22.4%)        87101505   (0.9%)          203070   (1.5%) 
   70    4258  (26.0%)       101479965   (1.0%)          236250   (1.7%) 
   80    4851  (29.6%)       115858425   (1.2%)          269430   (1.9%) 
   90    5443  (33.2%)       130236885   (1.3%)          302610   (2.2%) 
  100    6034  (36.8%)       144615345   (1.4%)          335790   (2.4%) 


n fp field exponentiations via bitshifts (size 48 bytes mod p)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     225   (1.4%)         1518100   (0.0%)            6700   (0.0%) 
    1     284   (1.7%)       921845747   (9.2%)         1792366  (12.8%) 
    2     343   (2.1%)      1842173394  (18.4%)         3578032  (25.6%) 
    3     403   (2.5%)      2762501041  (27.6%)         5363698  (38.3%) 
    4     462   (2.8%)      3682828688  (36.8%)         7149364  (51.1%) 
    5     521   (3.2%)      4603156335  (46.0%)         8935030  (63.8%) 
    6     579   (3.5%)      5523483982  (55.2%)        10720696  (76.6%) 
    7     640   (3.9%)      6443811629  (64.4%)        12506362  (89.3%) 
    8     699   (4.3%)      7364139276  (73.6%)        14292028 (102.1%) 
    9     757   (4.6%)      8284466923  (82.8%)        16077694 (114.8%) 
   10     815   (5.0%)      9204794570  (92.0%)        17863360 (127.6%) 


n fp field exponentiations via powMod (size 48 bytes mod p)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     255   (1.6%)         1449100   (0.0%)            6400   (0.0%) 
    1     314   (1.9%)      1230958822  (12.3%)         2005878  (14.3%) 
    2     374   (2.3%)      2460468544  (24.6%)         4005356  (28.6%) 
    3     433   (2.6%)      3689978266  (36.9%)         6004834  (42.9%) 
    4     491   (3.0%)      4919487988  (49.2%)         8004312  (57.2%) 
    5     549   (3.4%)      6148997710  (61.5%)        10003790  (71.5%) 
    6     611   (3.7%)      7378507432  (73.8%)        12003268  (85.7%) 
    7     669   (4.1%)      8608017154  (86.1%)        14002746 (100.0%) 
    8     728   (4.4%)      9837526876  (98.4%)        16002224 (114.3%) 
    9     787   (4.8%)     11067036598 (110.7%)        18001702 (128.6%) 
   10     847   (5.2%)     12296546320 (123.0%)        20001180 (142.9%) 


n base field inversion via ext euclidean algo(size 48 bytes mod p)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     253   (1.5%)         1449100   (0.0%)            6400   (0.0%) 
    1     313   (1.9%)       689507403   (6.9%)         1602764  (11.4%) 
    2     372   (2.3%)      1399703470  (14.0%)         3252314  (23.2%) 
    3     430   (2.6%)      2053889844  (20.5%)         4772406  (34.1%) 
    4     490   (3.0%)      3001332957  (30.0%)         6970218  (49.8%) 
    5     550   (3.4%)      3767662207  (37.7%)         8749231  (62.5%) 
    6     608   (3.7%)      4382571852  (43.8%)        10177982  (72.7%) 
    7     667   (4.1%)      5099568962  (51.0%)        11842785  (84.6%) 
    8     725   (4.4%)      5960271526  (59.6%)        13842488  (98.9%) 
    9     787   (4.8%)      6369870535  (63.7%)        14791795 (105.7%) 
   10     845   (5.2%)      7340117606  (73.4%)        17042865 (121.7%) 

About

a benchmark of a PlutusTx and Aiken implementation of the bls12-381 fields

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published