[issue36408] Tkinter multi-processing performance, Linux 10-25 times faster than Windows 10

2019-03-23 Thread J.E.McCormack


New submission from J.E.McCormack :

I am measuring multi-process GUI performance (Tkinter 8.6, Python 3.7) for 
drawing lines, circles, text boxes, etc. In a fairly typical experiment on a 
i7-6700HQ, 4-core (8 thread), on Windows 10 I measure 25.5k objects/sec for one 
process running alone, and 19.9k objects/sec total for eight processes. For 
Linux Kubuntu KDE desktop the figures are 61k objects/sec and 230k objects/sec 
(a multi-core boost of times 3.8). For running eight processes, the performance 
difference, KDE vs Win10, is therefore times 11.6. The difference over a range 
of tests is 10-25 times.

Clearly Win10 is not doing multi-core. Perhaps Tkinter is calling a Windows SDK 
function which is not thread-safe within the Windows GDI, imposing a 
single-thread barrier system-wide?

I am just wondering, firstly, if I have simply missed mention of this 
limitation anywhere. I can supply more info if needed.

--
components: Tkinter
messages: 338682
nosy: james.mccormack
priority: normal
severity: normal
status: open
title: Tkinter multi-processing performance, Linux 10-25 times faster than 
Windows 10
type: performance
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue36408>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36408] Tkinter multi-processing performance, Linux 10-25 times faster than Windows 10

2019-03-25 Thread J.E.McCormack


J.E.McCormack  added the comment:

I can run four independent processes (i.e. not using multiprocessing, with no 
links at all between them) yet the results show that only one core is running. 
Where is this lock taking place? Why would a tkinter process need to know about 
another tkinter process?

A little bit of history I have learned is that prior to Windows 7, the GDI 
sub-system imposed a global lock system-wide so that only one process (one 
thread) could write to the display at one time. This meant in effect it was a 
one-core GUI desktop. From Windows 7, this was supposed to have been 'fixed', 
but all I have read is that the "GDI lock became more fine-grained, reducing 
concurrency bottlenecks". I wonder did anyone ever measure performance in 
real-world scenarios to demonstrate whether there was in fact any improvement?

--

___
Python tracker 
<https://bugs.python.org/issue36408>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36408] Tkinter multi-processing performance, Linux 10-25 times faster than Windows 10

2019-03-26 Thread J.E.McCormack


J.E.McCormack  added the comment:

Attached is a minimal reproducer script which is sufficient to show the issue 
clearly.

It is a simple single-thread Tkinter program with one canvas. No 
multiprocessing, no shared variables, no connections between instances. 
Instructions at top of file.

Results on i7-6700HQ, 4-core (8 thread), 2.60GHz, 16GB, Windows 10:-

1 process running alone: 29k objects/sec
6 processes running concurrently:4.3k objects/sec each, = 25.8k 
objects/sec combined.

Conclusion: One-core performance, global system-wide lock.

--
Added file: https://bugs.python.org/file48232/mosaic.py

___
Python tracker 
<https://bugs.python.org/issue36408>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com