summaryrefslogtreecommitdiff
path: root/doc/strlcpy-timing.txt
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-09-06 13:41:52 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-09-06 13:41:52 +0200
commitd45dd31e35190cf08b1e716e7c3bd1468ddd5d88 (patch)
tree362ed3bf52fa67d15e35fba042aafe4e2a938065 /doc/strlcpy-timing.txt
parentbd82d030011cd8b9655e5ded6b6df9343b42a6bd (diff)
New upstream version 3.23upstream/3.23
Diffstat (limited to 'doc/strlcpy-timing.txt')
-rw-r--r--doc/strlcpy-timing.txt109
1 files changed, 109 insertions, 0 deletions
diff --git a/doc/strlcpy-timing.txt b/doc/strlcpy-timing.txt
new file mode 100644
index 0000000..56ed40c
--- /dev/null
+++ b/doc/strlcpy-timing.txt
@@ -0,0 +1,109 @@
+strncpy fills the buffer with \0s if there is room left, which can build up
+runtime if the buffer is much larger than the string to be copied. The turning
+point on i7-4600U is about when the buffer is 3 times larger or more than the
+string. Copying a M-char string into a buffer of size N with different
+strategies turned out as follows, not favorably for switching to memcpy
+approach:
+
+M->N: [str minus mem] (str=walltime, mem=walltime)
+
+ 3-> 4: 0.-18010833 (str=0.053766602 mem=0.071777435)
+ 3-> 8: 0.-02276861 (str=0.069214041 mem=0.071490902)
+ 3-> 16: 0.-02594396 (str=0.069160485 mem=0.071754881)
+ 3-> 32: 0.-06119749 (str=0.064986286 mem=0.071106035)
+ 3-> 64: 0.-10011776 (str=0.062121350 mem=0.072133126)
+ 3-> 80: 0.000049152 (str=0.071466420 mem=0.071417268)
+ 3-> 128: 0.-10057727 (str=0.062143411 mem=0.072201138)
+ 3-> 256: 0.006148232 (str=0.077881866 mem=0.071733634)
+ 3->1024: 0.133625167 (str=0.206994485 mem=0.073369318)
+ 3->2048: 0.335047756 (str=0.405503204 mem=0.070455448)
+ 7-> 4: 0.-28288138 (str=0.046614065 mem=0.074902203)
+ 7-> 8: 0.-20974635 (str=0.052778755 mem=0.073753390)
+ 7-> 16: 0.-06903916 (str=0.068165128 mem=0.075069044)
+ 7-> 32: 0.-11161234 (str=0.064787697 mem=0.075948931)
+ 7-> 64: 0.-12026108 (str=0.061544945 mem=0.073571053)
+ 7-> 80: 0.-01877441 (str=0.072047713 mem=0.073925154)
+ 7-> 128: 0.-11343544 (str=0.062557326 mem=0.073900870)
+ 7-> 256: 0.005472409 (str=0.079922333 mem=0.074449924)
+ 7->1024: 0.133164952 (str=0.206290338 mem=0.073125386)
+ 7->2048: 0.329050142 (str=0.403909643 mem=0.074859501)
+ 15-> 4: 0.-28134891 (str=0.046436269 mem=0.074571160)
+ 15-> 8: 0.-26808385 (str=0.047722251 mem=0.074530636)
+ 15-> 16: 0.-21857806 (str=0.052866161 mem=0.074723967)
+ 15-> 32: 0.-15183331 (str=0.058903617 mem=0.074086948)
+ 15-> 64: 0.-06020317 (str=0.068661890 mem=0.074682207)
+ 15-> 80: 0.-13077126 (str=0.061986539 mem=0.075063665)
+ 15-> 128: 0.-05110583 (str=0.069024087 mem=0.074134670)
+ 15-> 256: 0.010346893 (str=0.085920728 mem=0.075573835)
+ 15->1024: 0.130128294 (str=0.203516720 mem=0.073388426)
+ 15->2048: 0.384323201 (str=0.459435357 mem=0.075112156)
+ 31-> 4: 0.-40592735 (str=0.043398064 mem=0.083990799)
+ 31-> 8: 0.-40405756 (str=0.043312982 mem=0.083718738)
+ 31-> 16: 0.-42308714 (str=0.044729400 mem=0.087038114)
+ 31-> 32: 0.-14127856 (str=0.056652936 mem=0.070780792)
+ 31-> 64: 0.-01889875 (str=0.069010683 mem=0.070900558)
+ 31-> 80: 0.001793133 (str=0.072637736 mem=0.070844603)
+ 31-> 128: 0.-02607933 (str=0.068334098 mem=0.070942031)
+ 31-> 256: 0.018139903 (str=0.088753971 mem=0.070614068)
+ 31->1024: 0.133949645 (str=0.204402776 mem=0.070453131)
+ 31->2048: 0.398049056 (str=0.468551187 mem=0.070502131)
+ 63-> 4: 0.-40166921 (str=0.043758420 mem=0.083925341)
+ 63-> 8: 0.-40966732 (str=0.043495110 mem=0.084461842)
+ 63-> 16: 0.-43784039 (str=0.043770941 mem=0.087554980)
+ 63-> 32: 0.-31256988 (str=0.046623389 mem=0.077880377)
+ 63-> 64: 0.-13997348 (str=0.068499638 mem=0.082496986)
+ 63-> 80: 0.-13916305 (str=0.068620538 mem=0.082536843)
+ 63-> 128: 0.-08328403 (str=0.074551339 mem=0.082879742)
+ 63-> 256: 0.004095734 (str=0.087035878 mem=0.082940144)
+ 63->1024: 0.151451020 (str=0.233770899 mem=0.082319879)
+ 63->2048: 0.355839456 (str=0.438594030 mem=0.082754574)
+ 79-> 4: 0.-53092708 (str=0.045118918 mem=0.098211626)
+ 79-> 8: 0.-54340043 (str=0.043908506 mem=0.098248549)
+ 79-> 16: 0.-57213292 (str=0.043950458 mem=0.101163750)
+ 79-> 32: 0.-44929075 (str=0.047104201 mem=0.092033276)
+ 79-> 64: 0.-40841792 (str=0.060369798 mem=0.101211590)
+ 79-> 80: 0.-34512567 (str=0.072643063 mem=0.107155630)
+ 79-> 128: 0.-26004050 (str=0.081177431 mem=0.107181481)
+ 79-> 256: 0.-14164733 (str=0.093010965 mem=0.107175698)
+ 79->1024: 0.131262747 (str=0.238379553 mem=0.107116806)
+ 79->2048: 0.337908136 (str=0.444999897 mem=0.107091761)
+ 127-> 4: 0.-53463038 (str=0.044954314 mem=0.098417352)
+ 127-> 8: 0.-54030635 (str=0.044154075 mem=0.098184710)
+ 127-> 16: 0.-56778235 (str=0.044743552 mem=0.101521787)
+ 127-> 32: 0.-44858267 (str=0.047231395 mem=0.092089662)
+ 127-> 64: 0.-42149730 (str=0.059234517 mem=0.101384247)
+ 127-> 80: 0.-45513663 (str=0.062055806 mem=0.107569469)
+ 127-> 128: 0.-23468852 (str=0.083671245 mem=0.107140097)
+ 127-> 256: 0.-04999520 (str=0.102026030 mem=0.107025550)
+ 127->1024: 0.139261976 (str=0.246475516 mem=0.107213540)
+ 127->2048: 0.345950301 (str=0.453134545 mem=0.107184244)
+ 255-> 4: 0.-70209659 (str=0.044940128 mem=0.115149787)
+ 255-> 8: 0.-71166235 (str=0.044243636 mem=0.115409871)
+ 255-> 16: 0.-73994321 (str=0.044365563 mem=0.118359884)
+ 255-> 32: 0.-61137064 (str=0.047746212 mem=0.108883276)
+ 255-> 64: 0.-58453794 (str=0.059850772 mem=0.118304566)
+ 255-> 80: 0.-61859639 (str=0.062199397 mem=0.124059036)
+ 255-> 128: 0.-42561423 (str=0.081341036 mem=0.123902459)
+ 255-> 256: 0.-35252238 (str=0.127124980 mem=0.162377218)
+ 255->1024: 0.097331464 (str=0.259751271 mem=0.162419807)
+ 255->2048: 0.305789595 (str=0.468141377 mem=0.162351782)
+1023-> 4: 0.-161452842 (str=0.043764021 mem=0.205216863)
+1023-> 8: 0.-155095262 (str=0.043698735 mem=0.198793997)
+1023-> 16: 0.-153207918 (str=0.043675714 mem=0.196883632)
+1023-> 32: 0.-152565254 (str=0.047438108 mem=0.200003362)
+1023-> 64: 0.-144192775 (str=0.058773300 mem=0.202966075)
+1023-> 80: 0.-149929950 (str=0.062432021 mem=0.212361971)
+1023-> 128: 0.-132285886 (str=0.080313089 mem=0.212598975)
+1023-> 256: 0.-133526587 (str=0.108033655 mem=0.241560242)
+1023->1024: 0.-90772704 (str=0.311350193 mem=0.402122897)
+1023->2048: 0.088417585 (str=0.490594175 mem=0.402176590)
+1368-> 4: 0.-211901350 (str=0.044167308 mem=0.256068658)
+1368-> 8: 0.-203185010 (str=0.044571028 mem=0.247756038)
+1368-> 16: 0.-200207782 (str=0.044133973 mem=0.244341755)
+1368-> 32: 0.-202440240 (str=0.047977200 mem=0.250417440)
+1368-> 64: 0.-193238434 (str=0.058934429 mem=0.252172863)
+1368-> 80: 0.-200936170 (str=0.062169785 mem=0.263105955)
+1368-> 128: 0.-181397289 (str=0.081740755 mem=0.263138044)
+1368-> 256: 0.-183151788 (str=0.107983466 mem=0.291135254)
+1368->1024: 0.-142070533 (str=0.292431947 mem=0.434502480)
+1368->2048: 0.-16089517 (str=0.508519291 mem=0.524608808)