title: Crystal Lang Compiler Speed
body: <p>I was just wondering about the compiler speed of the Crystal programming language. It feels relatively slow:</p>
  
  <pre><code>➜ ~/Code/crystal/crystal_scheduler (master ✘)✹✭ ᐅ time crystal build --release src/crystal_scheduler.cr
  34.64s user 1.10s system 93% cpu 38.174 total
  ➜ ~/Code/crystal/crystal_scheduler (master ✘)✹✭ ᐅ time crystal build --release src/crystal_scheduler.cr
  36.11s user 0.83s system 93% cpu 39.465 total
  ➜ ~/Code/crystal/crystal_scheduler (master ✘)✹✭ ᐅ time crystal build src/crystal_scheduler.cr
  8.09s user 0.89s system 181% cpu 4.956 total
  </code></pre>
  
  <p>The code is relatively small, two shards, two classes. Compared to other compilation times I know from Java, this feels like long times.</p>
  
  <p>I get that release compiling is slow, but the git book states:</p>
  
  <blockquote>
    <p>The reason for this is that performance without full optimizations is
    still pretty good and provides fast compile times, so you can use the
    crystal command almost as if it were an interpreter.</p>
  </blockquote>
  
  <p>But 8s feels a bit slow to claim that you can use it "almost as if it were an interpreter".</p>
  
  <p>I was just wondering if
   - a) my compilation is especially slow / the compile times are normal
   - b) how it compares to other languages in your experience</p>
  
  <p>Compilation Stats:</p>
  
  <pre><code>Parse:                             00:00:00.0007470 (   0.25MB)
  Semantic (top level):              00:00:00.3968920 (  36.08MB)
  Semantic (new):                    00:00:00.0019210 (  44.08MB)
  Semantic (type declarations):      00:00:00.0355760 (  44.08MB)
  Semantic (abstract def check):     00:00:00.0012690 (  44.08MB)
  Semantic (ivars initializers):     00:00:00.0094640 (  44.08MB)
  Semantic (cvars initializers):     00:00:00.0394420 (  44.08MB)
  Semantic (main):                   00:00:00.6025030 ( 108.14MB)
  Semantic (cleanup):                00:00:00.0012750 ( 108.14MB)
  Semantic (recursive struct check): 00:00:00.0018930 ( 108.14MB)
  Codegen (crystal):                 00:00:00.7354530 ( 140.27MB)
  Codegen (bc+obj):                  00:00:33.2533520 ( 140.27MB)
  Codegen (linking):                 00:00:00.3647440 ( 140.27MB)
  </code></pre>
  
  <p>My System:</p>
  
  <pre><code>➜ crystal -v
  Crystal 0.22.0 (2017-04-20) LLVM 4.0.0
  </code></pre>
  
  <p>Hardware Overview:</p>
  
  <pre><code> Model Name:    MacBook Pro
   Model Identifier:  MacBookPro11,1
   Processor Name:    Intel Core i5
   Processor Speed:   2,8 GHz
   Number of Processors:  1
   Total Number of Cores: 2
   L2 Cache (per Core):   256 KB
   L3 Cache:  3 MB
   Memory:    16 GB
  </code></pre>