Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Борис Верховский
    @verhovsky
    signature differences aren't hidden if you're using JSON output though
    carbotaniuman
    @carbotaniuman
    Any reason RustPython/RustPython#2382 isnt being merged? Planning to trial out some GC stuff built on that so wondering if theres an objection to the change itself
    Noa
    @coolreader18
    @carbotaniuman I've been hesitant, I guess, to merge it, since a function call on every decref probably isn't great for performance. But, I haven't done any actual benchmarking and it's probably fine to do it just in the interim while we find a better solution (I'm leaning towards just copying over Arc/Rc implementation)
    pca006132
    @pca006132
    hi, I tried the fibonacci program in issue RustPython/RustPython#2445 , it seems that the atomics required by the "threading" feature is really killing the performance
    what is the use of the threading feature? and do we really need those atomic for threading feature? atomics would really hurt performance...
    For example, after adding fast path for int binops and optimizing the check signal function to avoid atomic swap, fib(33) on my computer took 10.627s when "threading" feature is on, and 6.29s when "threading" feature is off, and avoiding "threading" could allow other optimizations such as using RefCell for lasti instead of atomic integers.
    pca006132
    @pca006132
    and it seems not very efficient to load and store from the ctx for integers... I wonder if it would be possible to use fat pointer for PyObjectRef, so int32 can be stored in the ref directly without accessing ctx... but this may require large refactoring and idk how much performance improvement it can give
    Athul Muralidhar
    @AthulMuralidhar
    guys look at this - https://cryptography.io/en/latest/installation.html#rust - we might become eventually the main compiler for python! super excited
    Noa
    @coolreader18
    That's a pretty cool use of rust, but I think they use pyo3 for that, not RustPython -- they define a CPython extension module in Rust
    Athul Muralidhar
    @AthulMuralidhar
    yep, thanks for the clarification :)
    Zomatree
    @Zomatree
    i presume its not normal for rustpython to take 1h+ to import a couple modules, take up like 10GB of memory and max out a cpu core.
    Noa
    @coolreader18
    ooh, yeah, are you building in release mode?
    cargo build --release?
    or cargo run --release
    Zomatree
    @Zomatree
    cargo build
    Noa
    @coolreader18
    Yeah, make sure to build it optimized, non-release mode is definitely a lot slower
    Zomatree
    @Zomatree
    but an hour
    Noa
    @coolreader18
    Try release mode
    Zomatree
    @Zomatree
    im in release mode
    Noa
    @coolreader18
    ah
    what module are you importing?
    Zomatree
    @Zomatree
    aiohttp, attr, async_timeout, chardect, multidit, inda and yarl
    Zomatree
    @Zomatree
      PID USER      PRI  NI  VIRT   RES   SHR S CPU%▽MEM%   TIME+  Command
    30922 zomatree   20   0 11.5G 11.3G 12340 R 98.4 44.5  1h10:27 ./rustpython test.py
    does rustpython cache imports after they are imported once?
    Noa
    @coolreader18
    Yes, both as pyc in the filesystem and in sys.modules
    I don't think it should be taking that long
    How did you build ./rustpython?
    cargo build builds in debug mode
    you have to do cargo build --release to build optimized
    Zomatree
    @Zomatree
    https://mystb.in/AgentsFavorEncouraging i did build it in release mode
    Noa
    @coolreader18
    huh
    that is really strange
    I can't even import aiohttp, it errors after less than a second on a thing related to the typingmodule
    Zomatree
    @Zomatree
    i am using your branch with the metaclass patches
    Noa
    @coolreader18
    what does test.py look like? just import aiohttp?
    Zomatree
    @Zomatree
    yeah
    Noa
    @coolreader18
    I mean this fails after only a couple seconds
    ❯ target/release/rustpython
    Welcome to the magnificent Rust Python 0.1.2 interpreter 😱 🖖
    >>>>> import sys; sys.path.insert(0, '/home/coolreader18/rspy-tests/asynchttp')
    >>>>> import aiohttp
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/__init__.py", line 6, in <module>
        from .client import (
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/client.py", line 35, in <module>
        from . import hdrs, http, payload
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/http.py", line 7, in <module>
        from .http_parser import (
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/http_parser.py", line 15, in <module>
        from .helpers import NO_EXTENSIONS, BaseTimerContext
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/helpers.py", line 48, in <module>
        from typing_extensions import Protocol
      File "/home/coolreader18/rspy-tests/asynchttp/typing_extensions.py", line 364, in <module>
        class _FinalForm(typing._SpecialForm, _root=True):
    AttributeError: module 'typing' has no attribute '_SpecialForm'
    Noa
    @coolreader18
    Yeah, I tweaked a few things and I'm able to import it fine
    ❯ rustpython                                     
    Welcome to the magnificent Rust Python 0.1.2 interpreter 😱 🖖
    >>>>> import idna_ssl; import sys; sys.version_info = (3, 6, 0)
    >>>>> import aiohttp
    >>>>> aiohttp
    <module 'aiohttp' from '/home/coolreader18/rspy-tests/asynchttp/aiohttp/__init__.py'>
    Venu Vemula
    @venugopv_twitter
    Hi, I am newbie to RustPython. Spent some time in docs/examples/code.. but am not able to find a way to target python code to WASM. I am working on generic WASM Executor using which I can run WASM modules (i.e code complied to wasm from different languages like C, C++, Rust ). It would be great, if RustPython provides a way to target python for compiling to WASM.
    pca006132
    @pca006132
    I don't think RustPython is a compiler?
    Noa
    @coolreader18
    Yeah, you compile RustPython to wasm and then run the code using the interpreter
    pca006132
    @pca006132
    hi, is there documentation about how vm/src/slots.rs works? I'm a bit confused with the code, and not sure how to add more functions to it, like __add__ etc.
    Zomatree
    @Zomatree

    so going on with my importing issue from yesterday, it seems to be an issue with one of my other modules, it seems that rustpython is just hanging on some of my relative imports (from .a import B), none of the file that im trying to import gets executed.

    ive tried making a minimal but cant get any repro so im uploading the entire setup, https://github.com/Zomatree/discord.py/tree/rustpython-test and run rustpython -m discord it should print a bunch of stuff then hang at 16 that is trying to import discord/http.py from discord/client.py#61, does this hang for anyone else?

    Noa
    @coolreader18
    yeah it hangs for me after 16
    I was looking into trying to fix from . import x stuff, but it's so weird I don't know how it works in cpython
    Zomatree
    @Zomatree
    yeah like its working 99% of the time but just here its not
    Zomatree
    @Zomatree
    would be nice if rustpython errors or something instead of hanging and memory leaking
    this seems to be the cause of it eating 15GB+ of mem
    Noa
    @coolreader18
    oh i see. we implemented Instruction::ImportFrom wrong, lol. it should fallback to checking sys.modules if the attribute isn't there