speed and mpn_set_str

Zimmermann Paul Paul.Zimmermann at loria.fr
Tue Jan 8 13:35:39 CET 2013


       Hi,

it seems the speed command considers for mpn_set_str the size of the *input*,
i.e., the number of *bytes* of the input string, and not the number of limbs
of the corresponding mpn number.

This makes it difficult to compare it to other mpn functions:

frite% ./speed -s 1000-1100000 -f 2 -r mpn_mul_n mpn_set_str mpn_get_str
overhead 0.000000002 secs, precision 10000 units of 3.33e-10 secs, CPU freq 3000.00 MHz
            mpn_mul_n   mpn_set_str   mpn_get_str
1000      0.000155617       #0.0245        2.5939
2000      0.000406432       #0.0240        2.8337
4000      0.001040115       #0.0233        3.1667
8000      0.002980807       #0.0217        4.3318
16000     0.006768169       #0.0251        3.5462
32000     0.012000000       #0.0384        5.3337
64000     0.036002000       #0.0347        4.3333
128000    0.068004000       #0.0485        5.5883
256000    0.140008000       #0.0622        6.6857
512000    0.312019000       #0.0641        7.1282
1024000    0.732046000       #0.0710        7.1585

and even to compare mpn_set_str for different bases:

frite% ./speed -s 1000-1100000 -f 2 -r mpn_set_str.3 mpn_set_str.5
overhead 0.000000002 secs, precision 10000 units of 3.33e-10 secs, CPU freq 3000.00 MHz
        mpn_set_str.3 mpn_set_str.5
1000     #0.000002379        1.2447
2000     #0.000005903        1.2890
4000     #0.000014417        1.3177
8000     #0.000034429        1.4440
16000    #0.000086461        1.5232
32000    #0.000225264        1.5321
64000    #0.000577902        1.5777
128000   #0.001507353        1.5879
256000   #0.003899763        2.6305
512000   #0.012000000        1.3334
1024000   #0.024001000        1.6667

Would it be possible to use the *output* size instead for mpn_set_str?

If not possible (e.g., for compatibility reasons) would it be possible to
introduce a new name, say mpn_set_str2?

Paul Zimmermann


More information about the gmp-devel mailing list