Code Monkey home page Code Monkey logo

Comments (3)

colesbury avatar colesbury commented on September 16, 2024

Hi @xuanvuzzz2601 - I don't think pyenv for Windows supports nogil (only pyenv for Linux and macOS). You can use the Windows installer from here: https://github.com/colesbury/nogil/releases (python-3.9.10-amd64.exe), but be warned that there are fewer support C-API extensions for nogil on Windows than for Linux or macOS.

from nogil.

xuanvuzzz2601 avatar xuanvuzzz2601 commented on September 16, 2024

I have tested running the results of 2 programs with GIL and NOGIL but it doesn't seem to work on window. Please let me know what setup is needed for it to work.

imageimage

from nogil.

pjurgielewicz avatar pjurgielewicz commented on September 16, 2024

Hi @xuanvuzzz2601, what is your definition of working/not working? How do you invoke your script? I have run your example (with slight enhancements):

from threading import Thread
import time
import sys

print(sys.flags)

COUNT = 50000000

def countdown(n):
    while n>0:
        n -= 1

# 1st pass
start = time.time()
countdown(COUNT)
end = time.time()
print('Time taken in seconds -', end - start)

# 2nd pass
t1 = Thread(target=countdown, args=(COUNT//2,))
t2 = Thread(target=countdown, args=(COUNT//2,))

start = time.time()
t1.start()
t2.start()

t1.join()
t2.join()

end = time.time()
print('Time taken in seconds -', end - start)

And I got the following result running py -3.9 .\test.py (I do not have regular CPython 3.9 installed on my Windows machine)

sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0, dev_mode=False, nogil=True)
Time taken in seconds - 2.3499691486358643
Time taken in seconds - 1.1804711818695068

Please note that the nogil flag is set to True, indicating that nogil is being used. Please check and compare it on your system.

from nogil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.