# Same Python version, different optimizations on different OS?

**URL:** <https://discuss.python.org/t/same-python-version-different-optimizations-on-different-os/5098>\
**Category:** Core Development\
**Created:** [August 30, 2020, 11:56am UTC](https://discuss.python.org/t/same-python-version-different-optimizations-on-different-os/5098 "2020-08-30T11:56:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nedbat](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/nedbat/32/8744_2.png) [@nedbat](https://discuss.python.org/u/nedbat)\
**Post date:** [August 30, 2020, 11:56am UTC](https://discuss.python.org/t/same-python-version-different-optimizations-on-different-os/5098/1 "2020-08-30T11:56:50Z")

</div>

This coverage.py bug report ([https://github.com/nedbat/coveragepy/issues/1022](https://github.com/nedbat/coveragepy/issues/1022)) says that the same code running with the same Python version (3.8.5) executes differently on Windows vs Linux. That doesn’t sound right to me, and I don’t have Windows to test it with. Can anyone confirm/explain?

---

<div class="post-metadata">

**Author:** ![nedbat](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/nedbat/32/8744_2.png) [@nedbat](https://discuss.python.org/u/nedbat)\
**Post date:** [August 30, 2020, 1:48pm UTC](https://discuss.python.org/t/same-python-version-different-optimizations-on-different-os/5098/2 "2020-08-30T13:48:44Z")

</div>

This was reported against coverage earlier also: [https://github.com/nedbat/coveragepy/issues/959](https://github.com/nedbat/coveragepy/issues/959) Why does Windows behave differently than Linux?

---

<div class="post-metadata">

**Author:** ![ammaraskar](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ammaraskar/32/32_2.png) [@ammaraskar](https://discuss.python.org/u/ammaraskar)\
**Post date:** [August 30, 2020, 10:38pm UTC](https://discuss.python.org/t/same-python-version-different-optimizations-on-different-os/5098/3 "2020-08-30T22:38:27Z")

</div>

For any core developer who wants to look into this, based on my preliminary research this seems to be related to opcode prediction and computed GOTOS.

If you put `#define USE_COMPUTED_GOTOS 0` above [https://github.com/python/cpython/blob/master/Python/ceval.c#L1033](https://github.com/python/cpython/blob/master/Python/ceval.c#L1033) then this issue is re-creatable on Linux/Mac.

It seems to be an issue relating to how `f_lasti` is updated.

---

<div class="post-metadata">

**Author:** ![nedbat](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/nedbat/32/8744_2.png) [@nedbat](https://discuss.python.org/u/nedbat)\
**Post date:** [August 30, 2020, 10:49pm UTC](https://discuss.python.org/t/same-python-version-different-optimizations-on-different-os/5098/4 "2020-08-30T22:49:48Z")

</div>

Thanks, I created [https://bugs.python.org/issue41670](https://bugs.python.org/issue41670) for it.
