Live data from Hacker News

Drop millions of allocations by using a linked list

github.com

121–130 of 158 posts

Re: Drop millions of allocations by using a linked list

#121
post #17
post #6

Earlier quoted context omitted.

Really. Every time I whine publicly how web programming people aren't familiar with even basic CS, I get a slap. But really, I should move to web programming. I'll be an expert computer scientist there, probably.

Annnndddd.... what reaction do you expect? "Oh, please come and do web development so we can bask in the glow of your self-righteousness and infinite knowledge of computers." /snark (apologies for being offensive, but good lord, what a silly statement - unless I missed the joke) I stand before you as a counterpoint to your foolish generalisation, and guess what, I know plenty of other people that don't fit your stere…

"Oh cute, a web dev. You've just reinvented 1975, but this time without algorithmic analysis. Would you like a pat on the head?"

/snark

Bluntly, web devs often screw up in the fundamentals of algorithmic operations and data. Web dev comes out of the horrific slap-it-up-i-tude of the HTML/Perl days of the mid-90s, and its tooling is still incredibly shoddy compared to desktop development. And the really fun part is? Web devs don't even get it. They often think they are the top of the food chain, with the best tools ever built. I still can't even find a tool to match VB 5's capabilities.

Re: Drop millions of allocations by using a linked list

#122
post #59

I'm not a ruby dev, so I guess maybe my perspective is not that great on this particular issue... but hats off to the dev with the fix, indeed this is how free software collaboration is supposed to work in my opinion. Even the dev with the fix wasn't rude about the original problem, he seemed pretty humble about it actually. If you think the Ruby guys are such shitty programmers you should be able to dive into their…

> Even the dev with the fix wasn't rude about the original problem, he seemed pretty humble about it actually. The Ruby community is very good interpersonally from my experience. It's a culture that I think comes from this: http://en.wikipedia.org/wiki/MINASWAN

Unfortunately, the rails community are the visible minority, and they follow DHH's example more than Matz's.

Re: Drop millions of allocations by using a linked list

#124
post #110

Earlier quoted context omitted.

The codebase of rubygems is... not exactly welcoming. What a very polite way to put it. IMHO that whole mess (rubygems + bundler) would ideally be replaced from scratch, removing the need for bundler in the process. If any generous sponsor wants to improve Ruby as a whole, that's where their money should go. Imagine the productivity gains if everyones test-cycle was suddenly >10% faster, and nobody would have to wast…

I'm reasonably sure some of the rubygems maintainers stated that in $FUTURE_VERSION bundler's functionality will be folded back in rubygems itself. Rubygems is a very old project and it was basically stalled for a long time, it has already made quite big strides recently. But I don't think it's rubygems' role to fix what rvm/rbenv fix (multiple rubies). Jars don't do that either :)

But I don't think it's rubygems' role to fix what rvm/rbenv fix

Well, it all sticks together. I would say ruby-build should be retained as an external tool to conveniently fetch and install ruby versions.

However, we should very much replace the god awful environment magic that rbenv/rvm perform with native ruby/rubygems support for version/project-scope gemsets.

Rbenv is a well designed crutch - but still a crutch.

In an ideal world you'd checkout a ruby project, point any recent ruby-binary at its Gemfile, and it would download/install not only the required gems, but if necessary also the required Ruby version, as specified by the Gemfile.

It would store everything in './.ruby', which could optionally be backed by a common shared directory (~/.ruby) for space efficiency.

Re: Drop millions of allocations by using a linked list

#125

It's always nice when a small change is a big win. This reminds me of the gc_disable() PR that reduced composer install times by half a few months back.

Here's an article on the composer change: http://blog.ircmaxell.com/2014/12/what-about-garbage.html

Re: Drop millions of allocations by using a linked list

#126
post #117
post #82

Earlier quoted context omitted.

But in Java this happens only with strings doesn't it?

Sort of... technically only the '+' operator only applies to strings... however it is essentially the same issue as the pull request, from what I can gather (I assume the issue comes from allocating a new array with size length+1 and copying the original each time a record is added). Same thing happens with java.util.ArrayList.add() and its cousins though, and from my experience people rarely use the constructor spec…

Java's JIT compiler optimises string concatenation by substituting a StringBuilder and has been doing so for a while.

As to using the wrong data type, that's really the programmer's fault. If you don't allocate enough capacity or use another data type (e.g. LinkedList) if you don't know the required capacity, you are doing a bad job.

Re: Drop millions of allocations by using a linked list

#127
post #44

Semi-related: does anyone know why installing gems is so ridiculously slow? What is the thing doing? Downloading tarballs, yes, but then? It's a dynamic language; there is no compilation or verification! Why can I install Ruby packages using apt almost immediately, when gem/bundle install takes half a coffee break? I'm growing more impatient with the years. I have measured out my life with slow software. We talk abou…

also, your ISP provider often has some shitty DNS so switching to Google's might help. give the big brother all your datas!

Re: Drop millions of allocations by using a linked list

#128
post #51

I'm really surprised by the amount of smugness in the comments here. A bit of good-natured teasing, followed by a wheelbarrow full of "ruby-devs" this and "web-devs" that. Take off your Hats of Superior Coding. Any one of us, regardless of honorific titles, could have made this mistake, and you know it. Being steeped in CS Fundamentals does not immunize you against bugs. Congratulations to tenderlove for finding the…

I think that Arrays are so ubiquitous and (usually) so fast that most devs reach to them by default unless there's a good reason not to. I can count on one hand the number of times a linked list has really truly been the correct solution to a programming problem I've faced.

Re: Drop millions of allocations by using a linked list

#129
post #75

Earlier quoted context omitted.

So many programmers have this weird inferiority complex when it comes to the term "engineer". Not you, but those who think that most programming can never be called "engineering" because people don't die if you introduce a software bug[1] (as if the only kinds of modern "engineers" have to do with immediately safety-critical things). I prefer the plain "programmer" myself, but I don't see the big deal unless "enginee…

I'm a little sheepish about using it around the engineers in my life because I know I'm not legally liable and held accountable to the same standards they are when I make a mistake in the software I ship. I like to think I take a certain amount of rigor in the choices of tools and processes and design philosophy that reduces the amount and impact of bugs... but if we get a customer complaint about our product we don'…

Like I said: inferiority complex.

Re: Drop millions of allocations by using a linked list

#130
post #117
post #82

Earlier quoted context omitted.

But in Java this happens only with strings doesn't it?

Sort of... technically only the '+' operator only applies to strings... however it is essentially the same issue as the pull request, from what I can gather (I assume the issue comes from allocating a new array with size length+1 and copying the original each time a record is added). Same thing happens with java.util.ArrayList.add() and its cousins though, and from my experience people rarely use the constructor spec…

Just to clarify, java.util.ArrayList.add() grows the backing array by 50%, not just by length()+1.
Post reply on HN