How to control using CPU cores [Crystal]
<p>I tried to run the same program on both Ruby and Crystal.
In the program, there is no code which controls threads.</p>

<p>As for Ruby, Only 1 core is used and the usage is 100% through the program as following screen shot indicates
<a href="https://i.stack.imgur.com/6WojE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6WojE.jpg" alt="enter image description here"></a>
and the report of time command is</p>

<pre>
real    5m21.168s
user    5m20.784s
sys 0m0.296s
</pre>

<p>As for crystal, all cores are used and the usage of CPU about 170%.
<a href="https://i.stack.imgur.com/6ABx9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6ABx9.jpg" alt="enter image description here"></a>
and time report is </p>

<pre>
real    1m51.299s
user    2m25.876s
sys 0m48.380s
</pre>

<p>Does this mean that the compiler of crystal does specific work to build a binary which uses cores reasonably?
If so, is there any way to create a binary which runs on only 1 core like Ruby?</p>

<p><strong>condition</strong></p>

<ul>
<li>CPU: Intel core i7 6700</li>
<li>OS: Ubuntu 16.04 64bit</li>
<li>Ruby version: 2.4.0-preview2</li>
<li>Crystal version: 0.18.7 / 0.19.1</li>
</ul>

<p>----------- added following description on 13th/Sep 2016 --------------</p>

<p><strong>code</strong></p>

<ul>
<li>Crystal code: <a href="https://github.com/elgoog/crystal_brain" rel="nofollow noreferrer">elgoog/crystal_brain</a></li>
<li>Ruby code: <a href="https://github.com/elgoog/ruby_brain" rel="nofollow noreferrer">elgoog/ruby_brain</a></li>
</ul>

<p>I executed the code with following steps.</p>

<pre><code>$ crystal build examples/wave_form_standalone.cr
$ ./wave_form_standalone &gt; /dev/null
</code></pre>

<p>By the way, I checked with following simple code in order to isolate the cause.</p>

<pre><code>j = 0
10000000000.times do |i|
  j += i
  j -= 1
end
</code></pre>

<p>This code uses 1 core and the usage 100% correctly.
However many cores are used with above crystal code of github.
So, this seems to depend on the code.
Is there the possibility that GC runs frequently and main program can't use CPU efficiently?</p>