News for hackers. Stuff that matters.
Re:My Journey from R to Julia by pxmpxm on Sunday January 29, 2023 @07:21AM (#34567437)
That's some pretty generic premature optimization cargo culting.

If you have a huge data set and some understanding what you're doing, the bottlebecks will be pretty obvious.

Re:My Journey from R to Julia by em500 on Sunday January 29, 2023 @08:00AM (#34567689)
Apparently not obvious enough for people to estimate in advance if they should avoid looping.

Pike point is not just to avoid premature optimization. It’s to measure bottlenecks. Because due to changing language and hardware developments, what you think you knew to be true might become outdated.

Re:My Journey from R to Julia by pjmlp on Sunday January 29, 2023 @08:49AM (#34568046)
One of the reasons why Mark Godbolt created compiler explorer was to prove teammates that what for them was pretty obvious actually wasn't.
Re:My Journey from R to Julia by adgjlsfhk1 on Sunday January 29, 2023 @09:48AM (#34568589)
There's a reason Godbolt was made for C/C++ rather than python/R. In a fast language you need to know what the compiler is doing to know what's slow. In a slow language, the slow part is pretty much always just "code that does anything in the language".
Re:My Journey from R to Julia by pjmlp on Sunday January 29, 2023 @10:19AM (#34568843)
Python is only slow because so far there has been a huge disregard for JIT implementations, versus how other dynamic languages have decided to deal with perfomance issues.
Re:My Journey from R to Julia by adgjlsfhk1 on Sunday January 29, 2023 @10:28AM (#34568931)
PyPy definitely shows that python could be 5x faster than it is, however this would still be ~10x slower than Julia/C/C++ (and R is roughly 5-10x slower than python now)
Re:My Journey from R to Julia by pjmlp on Sunday January 29, 2023 @11:24AM (#34569567)
Yes, but it will never part of the development workflow of most Python developers, and the ongoing CPython JIT work sponsored by Microsoft will hardly win any JIT performance prices, given its design goals.

In any case, there is a reason why Python has a profiler in the box, as what one thinks and what actually is, isn't the same. Which was my starting point.

Re:My Journey from R to Julia by markkitti on Sunday January 29, 2023 @04:49PM (#34573128)
In Julia I do not need the Godbolt compiler explorer. The macros `@code_llvm` and `@code_native` show me the LLVM IR and native code for a function.

  julia> @code_llvm debuginfo=:none 5.0 + 3
  define double @"julia_+_156"(double %0, i64 signext %1) #0 
  {
  top:
    %2 = sitofp i64 %1 to double
    %3 = fadd double %2, %0
    ret double %3
  }

  julia> @code_native debuginfo=:none 5.0 + 3
  ...
    vcvtsi2sd %rdi, %xmm1, %xmm1
    vaddsd %xmm0, %xmm1, %xmm0
    retq
  ...