Live data from Hacker News

My Journey from R to Julia

drtomasaragon.github.io

51–60 of 120 posts

Re: My Journey from R to Julia

#51
post #31
post #9

Earlier quoted context omitted.

So Rob Pike’s rule 1 and 2 again: Rule 1. You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is. Rule 2. Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest. https://users.ece.utexas.edu/~adnan/pike.htm…

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.

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

#52
post #26

I’ve made most of my career turning scientific and mathematical code into maintainable and aesthetic code, and the red flag for me in this article is that he evidently couldn’t keep up with the Python learning curve and chose instead a language with no traits, no interfaces, and no classes. So, the amount of organization in his code is effectively zero. I understand that Julia 2.0 is slated to have some sort of concr…

> no traits, no interfaces, and no classes. So, the amount of organization in his code is effectively zero. This is an utterly deranged take. Do you mean to say that adherence to OOP and code organization are the same thing ?

Deranged? You could've said that you disagree and leave it at that.

Re: My Journey from R to Julia

#53
post #34

TLDR: Author switched to Julia because he “fell in love” with it, with no further qualification. He then speaks a bit about multiple dispatch and how it’s useful when it’s suitable. Personally I saw nothing here that might actually convince someone to switch. R + Tidyverse + Rcpp + CRAN is formidable.

> Rcpp

Rcpp is the worst thing that ever happened to humanity. Crazy build system, impossible magic words and macros, poisons an entire C or C++ project with new headers etc., extremely to downright impossibly hard to compile without R specific compiler tools. Two different build systems for whatever reasons in sourceCpp, compiler just includes arbitrary files, maintainer is ahem extremely condescending to any Q&A questions on SO and GH and doesn't understand why crazy long errors aren't just obvious

Re: My Journey from R to Julia

#54

I’ve made most of my career turning scientific and mathematical code into maintainable and aesthetic code, and the red flag for me in this article is that he evidently couldn’t keep up with the Python learning curve and chose instead a language with no traits, no interfaces, and no classes. So, the amount of organization in his code is effectively zero. I understand that Julia 2.0 is slated to have some sort of concr…

[dead]

Re: My Journey from R to Julia

#55

> For example, in R, we try to avoid loops because they are very inefficient This was true before, but the performance of for loops has been improved a lot later years, and while vectorization is still faster, for loops are no longer a no-no See https://www.r-bloggers.com/2022/02/avoid-loops-in-r-really/

It's a really sticky misconception. I've seen many beginners telling others to "never ever use loops in R", and so you end up with nested sapply()s or whatever soon-to-be-deprecated tidyverse functions are in vogue that nobody can reason about.

> so you end up with nested sapply()s

And that's usually not even vectorizing anything, it just hides the for-loop that is buried somewhere in the apply-code...

Re: My Journey from R to Julia

#56
post #14

This has been said before multiple times over but with these languages it is rarely about the languages themselves but their ecosystems: https://cran.r-project.org/web/packages/available_packages_b... To go from R to Julia, as an example, one would have to give up on a hundred or so high-quality packages potentially related to their activities.

You don't have to. Just use Rcall.

Of course R has been here longer. Eleven years after its creation, R had fewer than 500 packages. Julia was released in 2012 and today has over 7,000 packages.

Re: My Journey from R to Julia

#57

R can handle the examples in the article with generic functions: oddsratio Then: oddsratio(12L, 6L, 2L, 29L) # 29 oddsratio(12/(12+2), 6/(6+29)) # 29 oddsratio(matrix(c(12,6,2,29), 2)) # 29

This works, but only because you can tell which function you need to call using only the first argument.

A more compelling example for Julia would have to have two modes of operation where the first argument has the same type in both modes, but later arguments have different types.

Re: My Journey from R to Julia

#58

R can handle the examples in the article with generic functions: oddsratio Then: oddsratio(12L, 6L, 2L, 29L) # 29 oddsratio(12/(12+2), 6/(6+29)) # 29 oddsratio(matrix(c(12,6,2,29), 2)) # 29

This works, but only because you can tell which function you need to call using only the first argument. A more compelling example for Julia would have to have two modes of operation where the first argument has the same type in both modes, but later arguments have different types.

True, but in R (at least in S3) it's probably avoided by design because of default parameters. A short example:

  genericfun.type1 
The single case can be differentiated:

  genericfun(x)
But which function are we calling with:

  genericfun(x, y)
I don't know about Julia and how it solves this. Maybe by not allowing to pass nameless optional arguments.

Re: My Journey from R to Julia

#59
post #9

Earlier quoted context omitted.

So Rob Pike’s rule 1 and 2 again: Rule 1. You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is. Rule 2. Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest. https://users.ece.utexas.edu/~adnan/pike.htm…

Avoid the allure of premature optimization

But embrace the repulsion from belated pessimization. As Len Lattanzi said, it's the leaf of no good.

Re: My Journey from R to Julia

#60
post #14

This has been said before multiple times over but with these languages it is rarely about the languages themselves but their ecosystems: https://cran.r-project.org/web/packages/available_packages_b... To go from R to Julia, as an example, one would have to give up on a hundred or so high-quality packages potentially related to their activities.

That is exactly the issue. No language comes close to the richness of the R statistical package ecosystem.

It's not an issue at all with RCall and PyCall.
Post reply on HN