Computer Languages Character Distribution

,

This page reports the frequency of characters used in each programing language.

C

lang: c, total:5,650,428
 1  _  19.1%
 2  ,  9.7%
 3  )  9.3%
 4  (  9.3%
 5  *  7.7%
 6  ;  6.9%
 7  =  5.7%
 8  -  4.0%
 9  /  4.0%
10  "  3.3%
11  .  3.2%
12  >  2.4%
13  {  2.1%
14  }  2.1%
15  #  1.8%
16  &  1.3%
17  :  1.1%
18  +  0.9%
19  \  0.9%
20  [  0.8%
21  ]  0.8%
22  '  0.8%
23  <  0.7%
24  !  0.7%
25  |  0.7%
26  %  0.3%
27  ?  0.1%
28  `  0.1%
29  @  0.1%
30  ^  0.1%
31  $  0.0%
32  ~  0.0%

C++

lang: c++, total:5,223,531
 1  ,  24.1%
 2  "  12.4%
 3  -  8.1%
 4  .  6.9%
 5  {  6.7%
 6  }  6.7%
 7  )  5.7%
 8  (  5.7%
 9  _  5.6%
10  ;  3.5%
11  +  3.1%
12  :  3.0%
13  /  2.3%
14  >  1.7%
15  =  1.5%
16  *  0.8%
17  <  0.5%
18  &  0.5%
19  !  0.2%
20  '  0.2%
21  [  0.2%
22  ]  0.2%
23  #  0.2%
24  |  0.1%
25  \  0.1%
26  %  0.1%
27  ?  0.0%
28  ~  0.0%
29  ^  0.0%
30  @  0.0%
31  $  0.0%
32  `  0.0%

Java

lang: java, total:4,106,030
 1  "  15.3%
 2  .  14.1%
 3  (  9.9%
 4  )  9.9%
 5  ;  8.0%
 6  ,  8.0%
 7  *  7.4%
 8  /  5.2%
 9  {  3.5%
10  }  3.5%
11  =  2.7%
12  :  1.7%
13  @  1.6%
14  -  1.4%
15  >  1.3%
16  <  1.3%
17  _  0.9%
18  [  0.7%
19  ]  0.7%
20  +  0.6%
21  '  0.5%
22  \  0.3%
23  !  0.3%
24  &  0.2%
25  ?  0.2%
26  #  0.2%
27  $  0.1%
28  |  0.1%
29  %  0.0%
30  ^  0.0%
31  ~  0.0%
32  `  0.0%

Bash

lang: bash, total:618,992
 1  -  14.6%
 2  &  13.4%
 3  _  10.8%
 4  "  9.4%
 5  '  6.9%
 6  /  5.9%
 7  $  5.6%
 8  .  5.4%
 9  >  3.0%
10  =  3.0%
11  #  2.8%
12  )  2.4%
13  (  2.1%
14  \  1.6%
15  :  1.6%
16  |  1.3%
17  <  1.3%
18  ;  1.1%
19  ,  0.9%
20  {  0.9%
21  }  0.9%
22  [  0.7%
23  ]  0.7%
24  *  0.6%
25  +  0.6%
26  ^  0.5%
27  !  0.5%
28  @  0.5%
29  ?  0.3%
30  %  0.3%
31  `  0.2%
32  ~  0.1%

Perl

lang: perl, total:3,670,250
 1  $  10.1%
 2  ,  7.0%
 3  =  6.4%
 4  '  6.1%
 5  _  5.8%
 6  (  5.4%
 7  )  5.4%
 8  :  5.2%
 9  >  5.2%
10  .  4.9%
11  ;  4.9%
12  -  4.4%
13  #  4.2%
14  "  3.8%
15  {  3.1%
16  }  3.1%
17  \  2.0%
18  /  1.9%
19  <  1.4%
20  ]  1.3%
21  [  1.3%
22  @  1.3%
23  !  1.0%
24  &  0.7%
25  %  0.7%
26  |  0.7%
27  +  0.6%
28  *  0.6%
29  ~  0.4%
30  ?  0.3%
31  ^  0.2%
32  `  0.1%

PHP

lang: php, total:1,857,328
 1  $  10.7%
 2  '  9.5%
 3  )  8.8%
 4  (  8.8%
 5  *  8.2%
 6  >  6.2%
 7  -  5.4%
 8  ,  5.4%
 9  ;  5.1%
10  =  3.9%
11  /  3.8%
12  \  3.5%
13  .  3.3%
14  _  2.8%
15  {  2.5%
16  }  2.5%
17  @  1.9%
18  :  1.7%
19  [  1.2%
20  ]  1.2%
21  "  1.1%
22  <  0.8%
23  ?  0.4%
24  !  0.3%
25  &  0.3%
26  %  0.2%
27  |  0.2%
28  +  0.1%
29  #  0.0%
30  ^  0.0%
31  `  0.0%
32  ~  0.0%

Python

lang: python, total:2,580,277
 1  _  11.9%
 2  .  11.7%
 3  '  10.6%
 4  )  9.0%
 5  (  9.0%
 6  ,  8.6%
 7  "  6.8%
 8  =  6.1%
 9  :  5.6%
10  #  3.9%
11  -  3.4%
12  >  1.5%
13  [  1.5%
14  ]  1.5%
15  /  1.4%
16  \  1.4%
17  %  1.2%
18  *  0.7%
19  <  0.7%
20  `  0.7%
21  {  0.6%
22  }  0.5%
23  +  0.5%
24  ;  0.2%
25  $  0.2%
26  |  0.2%
27  @  0.2%
28  !  0.1%
29  ?  0.1%
30  &  0.1%
31  ^  0.1%
32  ~  0.0%

Ruby

lang: ruby, total:1,593,243
 1  _  15.2%
 2  .  9.3%
 3  :  7.5%
 4  "  7.4%
 5  ,  6.5%
 6  #  6.3%
 7  =  6.2%
 8  )  4.9%
 9  (  4.9%
10  '  4.4%
11  >  3.5%
12  /  3.2%
13  <  3.0%
14  @  1.9%
15  [  1.8%
16  ]  1.8%
17  |  1.5%
18  {  1.5%
19  }  1.5%
20  -  1.5%
21  \  1.3%
22  +  1.1%
23  ?  1.1%
24  %  0.5%
25  *  0.5%
26  !  0.5%
27  &  0.4%
28  ;  0.3%
29  $  0.2%
30  ^  0.1%
31  `  0.1%
32  ~  0.1%

JavaScript

lang: javascript, total:4,130,590
 1  ,  17.8%
 2  "  9.2%
 3  (  8.9%
 4  )  8.4%
 5  .  7.9%
 6  /  7.3%
 7  '  6.8%
 8  ;  5.2%
 9  =  4.0%
10  :  3.4%
11  {  2.6%
12  }  2.6%
13  -  2.2%
14  _  1.8%
15  [  1.6%
16  ]  1.6%
17  *  1.5%
18  +  1.3%
19  \  1.3%
20  |  0.7%
21  >  0.6%
22  &  0.5%
23  <  0.5%
24  $  0.5%
25  !  0.4%
26  ?  0.3%
27  #  0.2%
28  `  0.2%
29  %  0.2%
30  @  0.1%
31  ^  0.1%
32  ~  0.0%

CSS

lang: css, total:174,350
 1  -  17.6%
 2  .  16.9%
 3  :  13.8%
 4  ;  12.9%
 5  {  5.7%
 6  }  5.7%
 7  ,  5.6%
 8  *  3.5%
 9  /  3.5%
10  #  3.3%
11  )  2.1%
12  (  2.1%
13  "  1.5%
14  =  1.5%
15  !  1.1%
16  %  0.7%
17  _  0.7%
18  '  0.4%
19  >  0.2%
20  @  0.2%
21  \  0.2%
22  [  0.2%
23  ]  0.2%
24  +  0.1%
25  `  0.0%
26  ^  0.0%
27  |  0.0%
28  <  0.0%
29  ?  0.0%
30  &  0.0%
31  ~  0.0%
32  $  0.0%

All Languages

Total num of files: 27,410

Total num of punc chars counted: 29,605,019

19.1% c
17.6% c++
14.0% javascript
13.9% java
12.4% perl
8.7% python
6.3% php
5.4% ruby
2.1% bash
0.6% css
{'c': 5650428, 'java': 4106030, 'python': 2580277, 'javascript': 4130590, 'c++': 5223531, 'perl': 3670250, 'bash': 618992, 'php': 1857328, 'ruby': 1593243, 'css': 174350}

All Langs Together, total punct chars:29,605,019
 1  ,  12.1%
 2  _  8.0%
 3  "  8.0%
 4  (  7.7%
 5  )  7.7%
 6  .  7.4%
 7  ;  4.8%
 8  -  4.4%
 9  =  4.3%
10  '  3.9%
11  /  3.8%
12  *  3.5%
13  :  3.2%
14  {  3.2%
15  }  3.2%
16  >  2.4%
17  $  2.2%
18  #  1.7%
19  +  1.2%
20  \  1.1%
21  [  1.0%
22  ]  1.0%
23  <  1.0%
24  &  0.9%
25  @  0.7%
26  |  0.5%
27  !  0.5%
28  %  0.3%
29  ?  0.2%
30  `  0.1%
31  ^  0.1%
32  ~  0.1%

Sources

The source code are from:

The code for this report is at https://github.com/xahlee/count_lang_chars. Feel free to clone. If you do improve it and contribute back, that'd be great.

I did this in order to design a keyboard layout for programers. See: ErgoEmacs Keyboard.

blog comments powered by Disqus