Git Product home page Git Product logo

Comments (8)

pwaller avatar pwaller commented on August 22, 2024 1

I took a look at this. My first inclination was to dismiss it, as I couldn't reproduce the jank. But I looked very closely and did perceive a little jank, occasionally. A tiny amount, maybe once every 100 frames. Barely perceptible unless you look for it continuously and closely for a while.

So I decided to measure it. Here's a histogram, with milliseconds-per-frame on the x axis:

go-gl/glfw

image

C program using just glfw/glfw

image

Thoughts

Note the extremes on the left and the right. This data only represents a few seconds of runtime, so those individual data points are significant.

In any case I don't know if the effect I'm seeing is the same as @rucuriousyet is reporting, since we don't know what kind of choppiness he was experiencing. What we need is more data. Can someone report back with their frame timings? If you dump them in a file and attach them here, I can make a histogram. I'm just taking the elapsed time variable in gl41core-cube.

You can see there is quite a wide skew. I have run with GODEBUG=gctrace=1,schedtrace=1, but don't see anything correlating with the long frames on the Go side. There is no garbage collection occurring. This effect is observable even if I turn off all code except for glfw.SwapBuffer.

Based on what I've seen I think this could be a real (but subtle) effect, but I don't know what is at fault. It looks like it is glfw or something deeper in the stack. (I'm on recentish Nvidia drivers on Linux on a powerful card). The effect is so subtle to my eye that if it were present in other software I may not have noticed it. I can notice the effect worsening if I inject random delays of 1-5ms, implying that the delays shown in the above histograms might be the cause.

We're at the limits of what I'm able to debug for now. It would be interesting if someone is able to grab a fine time resolution trace and figure out where the time is getting lost. Maybe there is a bug in to be fixed somewhere in the stack :)

from example.

dmitshur avatar dmitshur commented on August 22, 2024

I don't see any choppiness or lag on my computer. It's a MacBook Pro with AMD Radeon HD 6770M 1 GB video card, running macOS 10.13.3. It seems to run locked to vsync at 60 hz (my monitor's refresh rate), without any skipped or dropped frames. I'm running go1.10beta2, but I never had issues with Go 1.9 or earlier.

What system do you have (CPU, GPU, OS, Go version, etc.)? If other people with similar systems can reproduce your issue, then it might be an issue in the code.

One way you can find out if the issue is with Go or elsewhere is by running a similar example from the GLFW C library (http://www.glfw.org/). If it happens there too, then it's not Go. If it doesn't, then the issue is somewhere here.

from example.

 avatar commented on August 22, 2024

from example.

slimsag avatar slimsag commented on August 22, 2024

@rucuriousyet are you getting > 60 FPS ? in my experience, vsync is usually disabled (or broken) by the driver and the higher framerate can cause choppiness & input lag due to having less CPU/GPU cycles when needed.

from example.

 avatar commented on August 22, 2024

from example.

slimsag avatar slimsag commented on August 22, 2024

Ah, gotcha. In that case I'm not really sure what the cause would be. Sorry I couldn't help!

from example.

 avatar commented on August 22, 2024

from example.

dmitshur avatar dmitshur commented on August 22, 2024

Oh, I just noticed cube.go isn't turning vsync on. Maybe it should be?

@rucuriousyet Can you try adding glfw.SwapInterval(1) // Vsync. to the source code (after window is created and its context is made current) and see if that helps your issue?

from example.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.