Hacker Newsnew | past | comments | ask | show | jobs | submit | dominicrose's commentslogin

I use WSL because I don't have the option to ditch Windows completely at work.

But here's an example of something that doesn't work well with WSL: having a git repository in Ubuntu (WSL) and reading/modifying it from Sublime Merge on Windows.

I'm forced to rely on the terminal git commands or on VS Code (because it can use a WSL back-end) and it's not ideal to be forced to a couple of options.


With "Works best with Microsoft Linux" stickers, it wouldn't be WSL 2.0 only.

That we already have today, and really WSL is only good enough for me to not bother having VMWare or Virtual Box, as I have been doing since switching back into Windows (during Windows 7 heyday) as main laptop OS.


Whenever Perl encounters a string literal in the code (especially one used as a hash key or a bareword), it often "interns" it. This means it stores a single, canonical, read-only copy of that string in a memory pool.

That's the core idea, and then Ruby has surface stuff like the symbol syntax and class. I'm pretty sure it's fine to use strings as hash keys though if you like.


> I'm pretty sure it's fine to use strings as hash keys though if you like.

Sure. They are just less efficient as hash keys.

Although now the distinction blurs with frozen strings (and the string literals being frozen by default switch).


Ruby has always had frozen strings (what it didn't have was interning of string literals, which is what the somewhat-poorly-named "# frozen_string_literal: true" option available from Ruby 2.3 and made default in Ruby 3.4 actually does, which makes string literals basically equivalent to symbol—but, not actually symbols, unlike, in another example of suboptimal naming, what would happen with String#intern, which has existed longer to intern strings, but is actually just an alias of String#to_sym.

In my experience, Ruby starts fast and does everything fast. But you can make a case against Ruby if you want, by making it do a lot of CPU work for a long time. Java may take some time to warm up and then it will destroy Ruby.

But why not simply write the code that needs to be fast in C and then use call it from Ruby?


>Ruby starts fast and does everything fast. you can make a case against Ruby if you want, by making it do a lot of CPU work for a long time

What is your definition of "everything"? It seems to not include computation on a thing known as a computer.


In the unix world, the usual philosphy is tko start with a script (bash, awk, perl,…), then move to C and the like when the usecase is understood enough. So it’s more like a switch from programs and ipc to libraries and function calls.

But there are stuff, you immediately know you want a program, but they’re likely to be related to stuff like pure algorithms, protocols and binary file formats


> But why not simply write the code that needs to be fast in C and then use call it from Ruby?

Because often that's a can of worms and because people are not as good with C as they think they are, as evidenced by plenty of CVEs and the famous example of quadratic performance degradation in parsing a JSON file when the GTA V game starts -- something that a fan had to decompile and fix themselves.

For scripting these days I tend to author small Golang programs if bash gets unwieldy (which it quickly does; get to 100+ lines of script and you start hitting plenty of annoyances). Seems to work really well, plus Golang has community libraries that emulate various UNIX tools and I found them quite adequate.

But back to the previous comments, IMO both bash and Ruby are quite fine for basic scripting... if you don't care about startup time. I do care in some of my workflows, hence I made scripts that pipe various Golang / Rust programs to empower my flow. But again, for many tasks this is not needed.


> the famous example of quadratic performance degradation in parsing a JSON file when the GTA V game starts -- something that a fan had to decompile and fix themselves.

I actually hadn't heard this story. Is the gamedev world still averse to using proper modern C++ with basic tools like std::map and std::vector (never mind whatever else they've added since C++11 or so when I stopped paying attention)? Or else how exactly did they manage to mess it up? (And how big are the JSON files that this really matters, anyway?)

> IMO both bash and Ruby are quite fine for basic scripting... if you don't care about startup time.

`time bash -c ''` is only a couple of milliseconds on my system. The slow thing about a bash script, usually, is how much of the work you do by shelling out to other commands.


Feast your eyes: https://nee.lv/2021/02/28/How-I-cut-GTA-Online-loading-times...

There were HN discussions at the time as well.


Amazing. The hashing thing is definitely on R*, but I wouldn't have expected an sscanf implementation to call strlen either. ("Ah, but of course they expect this kind of incremental parsing/tokenization to be done using the totally legit and un-problematic strtok instead!")

Well I gave up trying to understand C and C++ ages ago; they always felt like they sabotaged me for trying to get better at them. Moved on to many other programming languages.

In this case I believe they should have just vendored a small JSON parser in the game. It's a big blob of .exe and .dll files, why not? Found it weird but then again, we have all made mistakes that we later cringed at.


Also oof, I have no idea why I included bash here. I meant Python and Ruby. Thanks for calling me out.

> But why not simply write the code that needs to be fast in C and then use call it from Ruby?

From the things that have been coming out since YJIT has been in development and the core team members have been showing, that's not necessary. Methods that are written in pure ruby outperform C libraries called from Ruby due a variety of factors.


Well you are only responsible for your side of a 2-person relationship, no matter what kind of relationship it is. If the other person doesn't react in the best way, at least you tried and maybe that was the best thing to do based on the information that you had.

I guess most people think that it takes two persons to end a relationship but that's not true. It only takes one. If you're not that person, then maybe it's enough to know that it wasn't you because you tried.

Being stuck or being at the end is pretty much the same thing if you never get unstuck.


Node.js's core library is purposefully minimal. Purposefully or not, it's still an issue. Wether you add many small things to your project using an LLM or NPM, it still requires work and the annoying thing is that you'll have to do it for every new Node.js project.

Node.js is very good for IO and it has decent performance even for CPU-intensive work considering it's a dynamic language, but it would sure be nice to have a rich core library like Ruby or Clojure has.

The fact that ClojureScript can do it proves that it's doable even for front-end javascript (using advanced optimisations).


I wonder how well it would scale. Elasticsearch's performance is impressive even at an unrecommended scale.

> Most programming languages hide complexity from you

A garbage collector isn't "hidden complexity". We all know they exist and use memory and CPU.

How Zig is better than Ruby:

- it has a linear performance gain

- the IDE has more information

That's great if you absolutely need it, but in a lot of cases:

- you don't need linear performance gains or you need the gains to be more than linear

- the linear performance gains come at a huge cost: code readability (assuming you managed to write it and it compiles)

- relying too much on the IDE won't make better programs and won't make you a better programmer


The game I was the most addicted to was Age of Empires II, but I don't blame Microsoft for this: they just created an awesome game. Competition + "can't pause", these two can really make you disconnected from real life if you're competitive, but it's also fun and somewhat useful to know how much you can push yourself and how far you can go on the ladder.

My advice is to force yourself to stop playing after each single match, but that's hard when you're in a loosing streak because you want to win at least one match.

Paul Morphy has to become the best chess player before he understood that chess was a waste of time. He said that it's important to know the game well but there's a limit.


Virtue signaling is an insult that you can for example use against greenwashing or against someone who pledged to donate a lot of money to some charity but actually donated none or much less. Hypocrisy is also a form of virtue signaling.

It's also a term you can use against political opponents because it's much easier to speak well than to actually do good.

Refusing to negociate with criminals and help fund security seems like the proper long-term reaction for everyone.


Yes I tried with PHP and it failed with a size of 8800 for the Block Frequency Test, but it was fine at 880. Then I tried another random sequence of 8800 and it also failed the Autocorrelation Test.

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

Search: