Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F6463483
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
cem
May 6 2020, 12:53 AM
2020-05-06 00:53:27 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
raw.txt
View Options
```c
int main(int argc, char **argv)
{
static const size_t len = 2ull*1024*1024*1024;
char *src = malloc(len);
char dst[10];
int loops;
memset(src, 'A', len - 1);
src[len - 1] = 0;
loops = atoi(argv[1]);
for (int i = 0; i < loops; i++) {
strlcpy(dst, src, sizeof(dst));
}
return (dst[0]+dst[1]);
}
```
(Substituting strlcpy implementation. I verified the optimizer was not cheating and inlining the loop.)
Invoked:
```
for i in $(jot 5) ; do /usr/bin/time ./a.exe 20 ; done
```
```
x dataa
+ datab
+----------------------------------------------------------------------------------------+
|+ |
|+ x |
|+ x |
|+ x |
|+ x x|
|A MA| |
+----------------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 5 16.93 17.5 16.99 17.084 0.23479779
+ 5 0.81 0.85 0.85 0.834 0.021908902
Difference at 95.0% confidence
-16.25 +/- 0.243193
-95.1182% +/- 0.149259%
(Student's t, pooled s = 0.166748)
```
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2569803
Default Alt Text
raw.txt (1 KB)
Attached To
Mode
P385 stupid benchmark
Attached
Detach File
Event Timeline
Log In to Comment