News for hackers. Stuff that matters.
Re:Python 3.11 is faster than 3.8 by Thaxll on Wednesday October 26, 2022 @02:15PM (#33347368)
It's probably "slow" because of sdl and cgo not native Go code. An emulator doesn't do much actually, it's about fixed array, bit shifting etc ...
Re:Python 3.11 is faster than 3.8 by jbverschoor on Wednesday October 26, 2022 @03:38PM (#33348317)
Yup.. a 240x performance difference (zig-py) has very little to do with the language, vm, or whatever. As soon as I saw that, I dismissed the benchmark.

By these standards a 10 year old cpu with a beefy GPU will beat any new cpu as well.

Re:Python 3.11 is faster than 3.8 by chlorion on Wednesday October 26, 2022 @09:20PM (#33351821)
What does a GPU have to do with any of this? I think you may be a little confused about something but I am not sure what.
Re:Python 3.11 is faster than 3.8 by logicchains on Thursday October 27, 2022 @03:35AM (#33354411)
>Yup.. a 240x performance difference (zig-py) has very little to do with the language, vm, or whatever.

It absolutely does. A simple for loop in the standard Python interpreter will literally take 100x longer than the same thing in a language like C/C++, try for yourself if you don't believe me. CPython is unbelievably slow.

Re:Python 3.11 is faster than 3.8 by jbverschoor on Thursday October 27, 2022 @05:55AM (#33355398)
Very interesting... Simple loop (0 -> 320000000) and add 1 to a variable.

I couldn't reproduce 100x (no optimization flags, otherwise it won't do anything)

  Apple clang version 14.0.0 (clang-1400.0.29.102) -> 0m0.347s
  ruby 3.1.2p20 -> 0m11.314s
  Python 3.8.12 -> 0m19.662s
So ruby is almost 60% faster, but the C version is "only" 32x faster than ruby. 55x python.

I thought the differences would be smaller these days

Re:Python 3.11 is faster than 3.8 by Shish2k on Wednesday October 26, 2022 @07:05PM (#33350811)
> It's probably "slow" because of sdl and cgo not native Go code

The other languages are also using SDL via their respective interacting-with-C interfaces - what makes Go special here?

Re:Python 3.11 is faster than 3.8 by Thaxll on Wednesday October 26, 2022 @08:04PM (#33351328)
Re:Python 3.11 is faster than 3.8 by chlorion on Wednesday October 26, 2022 @09:22PM (#33351840)
The author stated that the benchmarks run in headless mode, so I am not sure that it's SDL that's slowing it down here.

Even if it is SDL slowing it down, Go FFI being slow is still a real disadvantage compared to the other languages, and you can't just pretend like it doesn't exist in this case.