{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/Gtk.jl/issues/166","labels_url":"https://api.github.com/repos/JuliaLang/Gtk.jl/issues/166/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/Gtk.jl/issues/166/comments","events_url":"https://api.github.com/repos/JuliaLang/Gtk.jl/issues/166/events","html_url":"https://github.com/JuliaLang/Gtk.jl/issues/166","id":104066165,"number":166,"title":"Profiling performance: gtk_main()","user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-31T14:37:21Z","updated_at":"2015-08-31T15:37:30Z","closed_at":null,"body":"I'm working on a rewrite of ImageView based on Gtk. (Overall I'm extremely pleased with how it's going.) I did a little benchmarking using a small image, the one mentioned [just above here as a 4D image](https://github.com/timholy/ImageView.jl#programmatic-usage), while attempting a frame rate of 300fps. The surprise was that rendering the canvas was almost negligible: by far, the main bottleneck is the call to `gtk_main()`. You can browse the profile data here: http://www.mediafire.com/download/4bi61zbtvgz0qw1/profileGtk.svg. `iv.jl` is my test script. The way I profiled it was `@profile sleep(10)` and then hit \"play\" on the movie (enough times to keep it pretty busy).\r\n\r\nTo put it into context, though, it's still fairly snappy---I think I'm getting ~60fps in practice. Mostly I'm just greedy, as well as curious."},"comment":{"url":"https://api.github.com/repos/JuliaLang/Gtk.jl/issues/comments/136409171","html_url":"https://github.com/JuliaLang/Gtk.jl/issues/166#issuecomment-136409171","issue_url":"https://api.github.com/repos/JuliaLang/Gtk.jl/issues/166","id":136409171,"user":{"login":"vtjnash","id":330950,"avatar_url":"https://avatars.githubusercontent.com/u/330950?v=3","gravatar_id":"","url":"https://api.github.com/users/vtjnash","html_url":"https://github.com/vtjnash","followers_url":"https://api.github.com/users/vtjnash/followers","following_url":"https://api.github.com/users/vtjnash/following{/other_user}","gists_url":"https://api.github.com/users/vtjnash/gists{/gist_id}","starred_url":"https://api.github.com/users/vtjnash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vtjnash/subscriptions","organizations_url":"https://api.github.com/users/vtjnash/orgs","repos_url":"https://api.github.com/users/vtjnash/repos","events_url":"https://api.github.com/users/vtjnash/events{/privacy}","received_events_url":"https://api.github.com/users/vtjnash/received_events","type":"User","site_admin":false},"created_at":"2015-08-31T15:37:30Z","updated_at":"2015-08-31T15:37:30Z","body":"It looks like the profile view there doesn't include C functions, so it's hard to pinpoint the exact costs. The draw function is called immediately, but the cost of blitting it to the screen is largely deferred to the draw/paint callback in the event loop. If you want maximal performance, the Gtk image object (optionally with a transparent Canvas overlay) is probably the fastest option for rending video on the CPU.\r\n\r\nuntested, but i think the following is roughly correct:\r\n```\r\nview = @GtkImage()\r\nw = @GtkWindow() |>\r\n  (GtkOverlay(image) |> \r\n    (overlay = Canvas()))\r\nimage = GdkPixbuf(width=100, height=100, has_alpha=false)\r\ndata = convert(Gtk.MatrixStrided, image)\r\nfill!(data, Gtk.RGB(0x224455))\r\nGtk._.image(view, image) # call this after changing pixel data to refresh display\r\n```\r\n\r\n(https://developer.gnome.org/gtk3/stable/GtkOverlay.html)"}}