Commit Graph

6 Commits

Author SHA1 Message Date
corfe83
a18cddb39f
Reduce heap allocations in thread.go and input.go (#1085)
I've been doing some profiling of a very simple ebiten project, and noticed that thread.go was doing a bunch of unnecessary allocations to accomplish its work. This change seeks to reduce GC work.

Input.go was also doing some unnecessary allocations.

The thread.go change reduces the total number of allocations per frame from 1342 to 852 (~36% reduction). The input.go change reduces it further to 752 (~44% total reduction). Perf tests were done on windows.
2020-02-21 09:59:45 +09:00
Hajime Hoshi
8dc2301e54 thread: Bug fix: Queue funcs instead of panic
Now the thread object is created at (*UserInterface).Run, we don't
have to care whether the (main) thread is started or not when
Call is called. Admit queueing the functions.

Fixes #884
2019-06-21 11:10:27 +09:00
Hajime Hoshi
449679665b thread: Use standard context.Context 2019-06-08 01:46:06 +09:00
Hajime Hoshi
9c283d45b4 thread: started should be reset after Loop 2019-06-06 00:25:57 +09:00
Hajime Hoshi
85dcafe176 thread: Rename Run -> Call 2019-06-06 00:25:57 +09:00
Hajime Hoshi
15a5896efd thread: Rename mainthread -> thread and add struct Thread
This enables thread available not only for the main thread but also
any threads.

This is a preparation for iOS Metal, that runs drawing functions on
a particular thread.

Updates #737
2019-06-06 00:25:53 +09:00