Hacker News new | past | comments | ask | show | jobs | submit login
Rubyist makes some Python code 5x Faster (schneems.com)
21 points by mariuz on Oct 7, 2017 | hide | past | favorite | 10 comments



I thought it was an insane CPython interpreter optimization or something.

Turns out it was a specific chunk of python snippet that

> determining all possible moves for a Queen piece on a chess-like board


Yep, that's what I thought as well and was curious to see the link between the author being a rubyist and contributing to python. Too bad it wasn't any such thing.

On the plus side tho', I thought the principles mentioned go beyond the specifics of the code snippent which was being used more like an example.

The author being a rubyist has no influence to anything mentioned in the article AFAICT.


It would be really good if the author actually linked to somewhere where you can reproduce the benchmark. Either way, I'm pretty sure the correct response is "use pypy", not that I can check it


Ugh, what's with the cheeky/inflammatory/click-baity title.

That's a turn off from an otherwise good article on guidelines one can use to easily identify opportunities to potentially optimize python code.


Huh? I thought the title was a perfect description of the article. A dude who mostly uses ruby optimizes a piece of Python code. That's it.


The "rubyist" is completely irrelevant to the article. The optimizations might apply as well in any number of languages, because they all are related to minimizing heap allocations and keeping the execution pipeline lean (e.g. by minimizing function calls).

It's fairly easy to think from the title that the article is going to be something about how clever the rubyist is compared to Python programmers or how slow Python is or some such, as an intrinsic property of "rubyists" or Python.


This is an assignment from Georgia Tech’s OMSCS 6601 class, Intro to AI. This was a super fun assignment, with lots of low hanging optimizations like this :)


The board contains only binary values. So why not use binary comparisons in integers ?

For any row, you test the row value & the current col and have your answer.


A Rubyist? Ruby is a nice language but because of its core design flaw of metaprogramming there's no point in trying to squeeze optimizations out of Ruby code. It's slow by design.


What on earth are you talking about?




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: