Skip to content

Instantly share code, notes, and snippets.

Created November 15, 2016 00:21
Show Gist options
  • Save anonymous/8386f531d69ece380b34efb42f1cd202 to your computer and use it in GitHub Desktop.
Save anonymous/8386f531d69ece380b34efb42f1cd202 to your computer and use it in GitHub Desktop.
# 10K lines.
## crystal
$ ltrace -c ./wcg < top10K.txt
10000 40000
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
91.16 8.003541 159 50279 memcpy
3.57 0.313160 200 1562 memset
1.61 0.140969 179 787 pthread_mutex_trylock
1.40 0.123235 168 731 pthread_mutex_unlock
0.71 0.062000 171 362 pthread_cond_broadcast
0.61 0.053994 7713 7 pthread_create
0.47 0.040891 3717 11 pthread_cond_wait
0.06 0.004981 199 25 memmove
0.04 0.003910 162 24 read
0.04 0.003590 138 26 sbrk
## C
$ ltrace -c wc -lw < top10K.txt
10000 40000
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
31.70 4.005181 28 138890 wcwidth
31.68 4.002060 28 138890 iswspace
31.64 3.997547 28 138890 iswprint
2.29 0.289029 28 10000 mbrtowc
2.28 0.288011 28 10000 mbsinit
0.18 0.023349 23349 1 dcgettext
0.11 0.013919 91 152 malloc
0.06 0.007156 81 88 free
### Perl
$ ltrace -c perl ./wc.pl < top10K.txt
10000 40000
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
30.36 1.118677 27 40400 malloc
30.01 1.105911 27 40118 free
29.98 1.104500 27 40110 memmove
7.87 0.290138 27 10409 memcmp
0.35 0.012853 41 308 memcpy
0.34 0.012526 40 306 strlen
0.30 0.010930 40 271 calloc
0.12 0.004442 46 95 pthread_getspecific
0.09 0.003189 39 81 realloc
0.07 0.002649 38 69 sigaction
0.06 0.002115 37 57 strrchr
0.05 0.001665 79 21 strncmp
0.04 0.001540 35 43 memset
0.03 0.001287 80 16 getenv
0.03 0.001211 37 32 strchr
0.03 0.001135 51 22 memchr
0.03 0.001095 42 26 read
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment