New submission from Shreyan Avigyan <shreyan.avig...@gmail.com>:

Today while working on an attempt to improve the GIL (either by modifying it or 
removing it) I noticed that in destroy_gil function first we unlock the mutex 
and then we set the gil->locked to -1 using _Py_atomic_store_explicit. 
Therefore the cycle is, "Unlock -> Atomic_Set_Value" which closely evaluates 
to, "Unlock -> Lock -> Set_Value -> Unlock"


I tweaked around a little and when I changed the cycle to, "Atomic_Set_Value -> 
Unlock" I noticed by running David Beazley's famous benchmarks that there's an 
increase in speed by 0.22 or something like that. I don't know if it's because 
of CPU instability or because of the tweak but it looks like an improvement. 
Should this patch be applied to cpython?

----------
components: C API
messages: 393642
nosy: shreyanavigyan
priority: normal
severity: normal
status: open
title: GIL Improvement
type: performance
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44130>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to