Is Gos gc slow?

blov · · 674 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Im interested in go but planned on using it for game dev. I tried using go-gl but my code as well as the demos were laggy when they moved. I dont want to use termbox and might have to find a different lang. Is the gc doing this?</p> <p>Code: <a href="https://github.com/go-gl/examples/tree/master/glfw31-gl21-cube">https://github.com/go-gl/examples/tree/master/glfw31-gl21-cube</a></p> <hr/>**评论:**<br/><br/>bastawhiz: <pre><p>All garbage collectors can be slow under the right conditions. You can write code though, especially in games, that doesn&#39;t allocate memory on the heap. That&#39;ll eliminate the possibility of problems with garbage collection. </p></pre>QThellimist: <pre><p>Couldcyou show how to make that?</p></pre>bastawhiz: <pre><p>I&#39;m looking at the code you posted and the drawScene method looks fine at first glance. If you post a video, I can try to look at what might be happening. When I get home, I can try to compile it and see for myself. </p></pre>zxy_xyz: <pre><p>Ill make a gif when im home. It has a sudden pause for a sec or 2 which ive been calling lag.</p></pre>bastawhiz: <pre><p>Given the code, GC seems an unlikely culprit, especially for pauses that long (I&#39;d expect a few dropped frames at most). I&#39;d look to make sure that your GPU is being used (plenty of tools online, one might be built in to your OS) and that you&#39;ve got the most up to date graphics drivers installed. </p></pre>zxy_xyz: <pre><p>Gonna have to try that as well. I run Opengl 3.1 mesa on linux and am able to run and program opengl code in languages like java and c++ which makes this odd to me.</p></pre>mixedCase_: <pre><p>Your example is running well on my laptop here, an Intel iGPU on Linux too. I also tried the OpenGL 4 cube using the discrete Nvidia GPU via Bumblebee (since the Intel Mesa drivers don&#39;t have support for the extensions it needs) and it also works well.</p></pre>zxy_xyz: <pre><p>Any idea what could be wrong? I run with go install then ./Executable.</p></pre>mixedCase_: <pre><p>Have you tried killing your compositor?</p></pre>zxy_xyz: <pre><p>Here&#39;s a gif of me using immediate mode and moving a square: <a href="http://i.imgur.com/f63bXx3.gifv" rel="nofollow">http://i.imgur.com/f63bXx3.gifv</a></p> <p>It has little pauses randomly throughout it&#39;s movement and it&#39;s coded to move constantly; no pauses intended.</p></pre>bastawhiz: <pre><p>The example code you posted works fine here. It&#39;ll be hard to say what&#39;s going wrong for you without seeing more code. </p></pre>zxy_xyz: <pre><p>I just changed the example code but modified it to be 2d. If it&#39;s smooth for you i wonder what&#39;s going with mine. :/</p></pre>lapingvino: <pre><p>can you try how e.g. 0AD runs on your system?</p></pre>zxy_xyz: <pre><p>What is OAD</p></pre>kd7nyq: <pre><p>Do you have some code we can look at?</p></pre>zxy_xyz: <pre><p><a href="https://github.com/go-gl/examples/tree/master/glfw31-gl21-cube" rel="nofollow">https://github.com/go-gl/examples/tree/master/glfw31-gl21-cube</a></p> <p>Heres the code example i used</p></pre>DualRearWheels: <pre><p>Real life example of mine: web server like app that handles around 4 requests per second and uses 20MB ~ 30 MB of RAM has total of 10 second of GC pause time per day. (Go 1.5) It can go x10 with heavier load, really depends on lot of factors.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

674 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传