Hacker News new | past | comments | ask | show | jobs | submit login

Good lord, this long-winded writing style is maddening to read!

Here's what he changed:

> Set<Thing> aSet = new HashSet<Thing>();

to:

> Set<Thing> aSet = new HashSet<Thing>(0);

His explanation:

"Most of these sets were empty for the entirety of their life, but each one was consuming enough memory to hold the default number of entries. Huge numbers of these empty sets were created and together they consumed over half a gigabyte of memory. Over a third of our available heap."

I'm not sure he ever got around to explaining how it saved "half a million dollars", though.




Have you ever noticed that it's becoming more difficult to find recipes without a six page blog entry on top of it? This is kind of like that.

I love the word bloviating for times like this. It's not really an onomatopoeia but something like it. It's also somehow clearly an insult.

Edit: jrockway has actually changed my perspective on recipe thing...if people want to put a six page backstory and photos on top of a recipe that's completely their right and I would never suggest that more quality (?) content is a bad thing. My problem, it seems, is with Google putting that as the top result when I'm searching for a recipe. Esp when I'm on my phone in a store getting spammed by some captive portal while trying to figure out if the damn cookies I'm making need baking soda or baking powder.


For recipes, it's possibly a way to qualify for copyright protection[0]. Recipes themselves aren't considered original enough, so authors can encase them in a copyrightable shell of narrative.

There might be other reasons for this on the net. And I wouldn't be surprised if new recipe bloggers write narrative because "that's how it's always been done."

[0]https://info.legalzoom.com/recipe-copyright-laws-20049.html


Except the copy-writable part is not the part anyone wants. But I think you're on the right track.

I'd argue it's the authors trying to differentiate (and add value to ) their copy of the recipe vs the 100s of others. And I suspect some do believe that adding dialogue or slightly changing the recipe covers them from copyright claims (not realizing recipes aren't covered) or provide them with some copyright protection of their own.

Others probably do it because that's the way it's always been done, but don't realize what they're trying to emulate...

It's the Martha Stewart / Alton Brown recipe for success, where the details are more interesting than the underlying recipe. But people mistake the extra detail for sentimental fluff (Martha Stuart) or technical babble that they don't understand (Alton Brown), and so they just perceive the formula as recipe plus fluff, without seeing the value that fluff should add.

Or they misjudge the value that they think they are adding with their own fluff.

Also probably relevant: recipes (along with product pages) are a couple of categories that Google treats drastically different than general web pages. And as a result has had unintended consequences for the worse, as far as overall quality of the web goes. I'm looking at you, affiliate links.


”Or they misjudge the value that they think they are adding with their own fluff.”

This. There are some blogs that really succeeds with the story-telling. I don’t mind the stories on Food Lab for example. But if it’s just an incoherent and fluffy word salad, then I’d rather just read the recipe straight away.


Good Story telling has its own value (to some), but I consider it to be different than what food lab, MS, or AB are doing, which I guess you could call more accurately a narrative of constructive details. As opposed to just an experience narrative to go along with the recipe.

The experience narratives can certainly be constructive as well, like maybe describing different versions of dishes tried at various restaurants when trying to recreate a recipe. But even most of these aren't helpful, depending on the author.

And of course the worst is the people who just try to describe an appropriate weather condition or family feeling that goes along with a meal, ala the Giada. Of course Giada is proof that even some people can make that model work well. It's just that most people on the internet don't.


I’ve read that it’s an SEO thing.

Some experts on Mashable agree [0]:

> SEO and marketing experts agree that Nelson's approach is a smart one, especially in such a saturated landscape. "Because a recipe usually consists of a listing of ingredients and steps, it’s often very difficult for a search engine to discern what this article is trying to convey,"

[0]: https://mashable.com/article/why-are-there-long-stories-on-f...


> "I do keyword research ... I see what kinds of questions people have around the topic, and look for ways to anticipate their problems, and answer their questions, so that they will have a successful cooking experience. Lately, I’ve been adding more step-by-step pictures of how to make dishes, as well as videos, because Google says that readers want that."

That makes sense to me. More keywords related to search topics means more hits.

>Nelson thinks there's an element of sexism to the critiques she sees about recipe writing.

Give me a break.

> "The feeling seems to be that they don't think these writers have something of value to offer," Nelson said.

I mean yes, most people do not care about your home life.

> By sharing stories on blogs, people get to know the types of foods [and] flavors that specific recipe creators enjoy. You figure out who is a good match for your own palate."

Do this after the recipe? Oh wait, that would mean I don't have to scroll past more advertisements... This is what everyone is complaining about. Getting to the actual recipe is quite annoying, especially on phones without ad blockers.


I didn’t mean to endorse the article itself, just the part about it probably being SEO-related as I remembered reading this before and just grabbed the first article I could find ;)


Of course of course, I was just having fun during some down time at work


I think a more likely reason is they are doing it for SEO


If you are trying to learn how to code, do you just want to find blocks of code to copy paste or do you want some explanation?

I realize sometimes the articles are pure fluff, but if you are passionate about what you are making, you want to read the how and why, the trial and error, and maybe even the history and backstory of the dish.


funny because there are very few blog specimens[1] actually explaining why a recipe is the way it is, the fluff is almost invariably how the recipe reminds author of grandma or how it's a staple of whatever social gathering they held.

1) like http://bressanini-lescienze.blogautore.espresso.repubblica.i...


... but wouldn't you just copy the recipe part anyways? If the narrative part is the copyrighted part, just don't copy that, thus ensuring that you're legally okay AND you only keep the part that's actually useful.


The "trick" is that the recipe is now part of a larger copyrighted work, so it's covered by the copyright. Of course, I doubt it'd be easy to win a trial if somebody did this unless it was literally copied verbatim.


Not an extracted recipe. Only as a part of the whole work. So if you copy the page, it's copyright-able, but not if you copy and paste just the recipe.


It’s almost as annoying as most news sites that have the headline, which is the same headline you already clicked on from google news or their homepage, then the subtitle which reiterates the headline. Then an image with a caption that is pretty much the same as the headline. Then the first line of the story which is also mostly the headline and then usually another repetition in the first paragraph.

Followed by a story which contradicts the headline, revealing the whole thing to just be click bait.


Sounds like a way to thwart services and sites that clip the first N lines of an article. You can't get the gist of the article until you've actually clicked through.


I think it’s just click-driven lazy journalism.


I would get autoplay video after the headline about irrelevant topic, ads, a lot of subjective and biased analysis, then the last sentence us what I was looking for.


Videos on news articles are the worst. I think it’s the evening standard that has a video at the top and when you scroll past trying to avoid it they pin it to the top right side and hide the close and mute buttons until it’s started playing. So annoying!


Install the Recipe Filter Chrome extension to fix this: https://chrome.google.com/webstore/detail/recipe-filter/ahlc...

> This Chrome browser extension helps cut through to the chase when browsing food blogs. It is born out of my frustration in having to scroll through a prolix life story before getting to the recipe card that I really want to check out.


I have heard also that this is done as an anti-scraping tactic. If your recipes are all nicely and consistently formatted, someone can steal all your content. If on the other hand you write it all in prose or at least intermixed with prose, any competitor will have to do each recipe by hand.


Yeah what’s up with all these new long-winded recipe sites? Is it a SEO thing?


The explanation I saw indicated that they keep readers on the site longer, which helps with both SEO and ad revenue (if they scroll deeper).


Basically optimizing for everything but good user experience.


Like the rest of the ducking modern web! I just spent an infuriating half an hour trying to locate somewhere to eat breakfast close by tomorrow. It will be faster and much better for my blood pressure to just walk around the neighbourhood until I see something that looks nice.

WTF happened? Seriously? It wasn’t long ago things like Google and google maps were actually helpful. And establishments had websites with menus and opening hours.


it is an SEO thing. Avoiding thin-content and adding contextually relevant text for search.


It's a "two-part greeting" thing.

But this is HN, so nobody knows what that is here. :)


Internet says "two-part greeting" is "Hello/Welcome. How can I help you?" which seems irrelevant to this context.


Hadn’t heard that term before. Feel free to explain :) Is it a sales thing?


Nice work flagging the answer HN.


I vouched it now, so it’s visible.


Nope, not visible. Good luck with that game of whack-a-mole.


Once the comment is vouched for I don’t think it will go invisible again. I loaded it in incognito mode and it’s visible there: https://news.ycombinator.com/item?id=21938682


Sorry, the comment wasn't worded in a way to make it obvious that it was intended to be an answer to the question. My fault for missing it.


Easily googled. Hi, welcome to hacker news. May I offer you some articles to read?


Hi. I easily googled "two-part greeting". Now I know it's about the greeting at the drive thru in McDonalds when you want two McDoubles.

Wait. No. That can't be it. It's about two critiques in drive thru greetings.

Wait. No. That seems irrelevant as well. It's a Yuletide thing? Answering the phone?

Wait. It's not easily googled. It's an obscure term of art apparently.


Hmm, not easily googled? I got something about drive-thrus but nothing actually using the term.


Why does anybody come to HN, except to find articles to read?

How would you know something is easily googled if you've never heard the term before?


It is simply an observation. There was apparently no overlapping term from say, network engineering, or dramaturgy, to confuse the search. Contrast with "Go (programming language) - Wikipedia" which led to the invention of "golang" as a keyword so that programmers could search out programming articles for that language efficiently.

BTW I did enjoy reading the article I found on "two-part greeting." [1]

[1] https://www.qsrmagazine.com/ordering/100-ways-improve-your-d...


Why does anybody go to McDonald's except to place an order?


Why does anyone visit a recipe site except to read half a novel about how the author remembers his childhood when dunking madeleines in their linden-flower tea? ;-)


I think humans naturally enjoy storytelling. So they tell stories on their blogs.


Excellent point, the problem isn’t with the content. It’s with google showing it as a top result for ‘meatloaf recipe’.


I used to write a lot of blog posts and, when it was to do with work, there was always some professional writer or marketing guy who said it was better to begin the post with some barely relevant fluff.

I didn’t agree, and it didn’t fit my own writing style. But they insisted I do it, or they’d edit it in themselves.

Same with this post. The ‘context’ wasn’t particularly enlightening. I thought I’d be reading a programming war story but there wasn’t any pay off.


I've studied writing all my life, and most of the classics on writing would agree with you, such as The Elements of Style and On Writing Well. William Zinsser, the author of On Writing Well and a newspaper editor, talks about this very thing, saying that articles are often improved by cutting the first three paragraphs.


The recipe thing, there's two different people that read these. People coming in from search only care about the recipe, and in that situation the story is mildly annoying. But even if I don't read it, I do find it at least a mild indicator that there's a human being that actually tried the recipe.

But I've subscribed to some food blogs because the recipes are decent and the stories make it interesting - otherwise, a series of recipes in my rss would just be incredibly boring. In this case it's closer to a tv personality you'd watch on tv than a recipe book.


Yep your second case is very legit and is why I softened my disdain with the edit.

I love Bon Appetit's youtube channel for example, and (ironically?) usually tune out at the end of their video when they get to the recipe at the end. Great point, thank you.


Quick and dirty solution to jump past the rambling and straight to the recipe: ctrl-F "print".

People love to ramble, but they also love being able to print a recipe to use in the kitchen.


Oh wow. I was briefly confused by the other comments not being about recipes because of this thread.


To be fair, this is just an example to illustrate the larger point, which, to me, seems to be that it is sub-optimal to be dogmatic over statements like "premature optimization is the root of all evil".

It seems plausible to me that halting the re-architecting project would produce the savings claimed.


But this isn't at all an example of "premature optimization". There was a well-defined, long-term issue they were having, and someone fired up a profiler, and showed that a particular change had a massive impact. That's exactly the opposite of "premature optimization".


I think it is supposed to be an example of just-in-time optimization that almost did not happen. The implication seems to be that the architects did not even consider code-level optimization as a possible solution.

Maybe the better message is "try to understand the causes of your problem before you try to solve it."


Preallocating space you won't need is premature optimization. I think that's what TFA meant to say, and maybe even said it, who knows.


In general, I’ve found some of the worst thinking in otherwise smart people from ideological thinking. My self-destructing rule of thumb is “don’t be an ideologue”.


Not all optimization is premature!


Precisely -- dogmatism fails because it does not deal with situations that call for sometimes subtle, case-by-case judgement.


the original premature optimization text posited scenarios where complicated algorithmic patterns were implemented (that took a significant amount of development time) before it was found out whether they were needed or not.

I think this is more

Obvious and simple optimizations are beneficial.

I feel in the case of this optimization it also improves the code by making it more clear what is wanted.

I think that is likely often the case with simple optimizations.


I was about to write a similar comment but you wrote it a minute earlier. :) Seriously, the writing is long-winded and meandering.

To add to the summary:

"This particular trick also no longer works. As I found out while writing this article, modern JDKs do not allocate any space in a HashSet until something is added."

So.. The article might have been better organized (and edited to 1/4 length) and focused on the section, "Four one liners every Java programmer should know". Unfortunately, it'd still be a click-baity title.


Numbers in headlines test better for SEO if they are odd, preferable prime.


If you read the article (what a novel idea!) the author explains that his company was running into heap size limits. The company was preparing to tackle this problem with a combination of extensive refactoring, server upgrades, licensing expensive third party libraries, and delaying new features while all of the above was done. His "optimization" reduced peak heap usage by half, making all the changes unnecessary.


This writing style is useful for beginners. Imagine a reader who's not already an expert, who isn't familiar with the decades worth of back and forth discourse about tradeoffs between performance and maintainability. He provides some context and history and tells a little story. Tech writing needs more of that.

Half a million seems like a good guess for how much the company would have lost paying developers and architects to re-design and re-implement the system, buy new hardware, new licenses for their third party software and the revenue they would miss out on by doing all that unnecessary work instead of building a profitable new feature.


> This writing style is useful for beginners.

The most useful writing, for both beginner and expert audiences, puts the most important content first, with supporting details later. Dispersing the lede late in the article serves the author/advertisers, not the audience, and is independent of whether the content contains context for beginners or a narrative style.


The section above describes all the hardware, new licenses, and labor needed to fix the problem by scaling up.

If anything I’d bet he underestimated the labor and opportunity costs.


He describes the re-architecturing which was partly motivated by memory usage issues, and the change he made which saved memory, but he doesn't explicitly say "this allowed us to avoid re-architecturing"


There are two types of people in the world. Those who can extrapolate from incomplete data...

The cynic in me wants to blame crippling licensing fees. Have you ever scaled up Oracle? Just typing that question gave me a nervous twitch.


It seems like you were reading the article with a mindset like "how do I save half a million dollars in my code with a one character change?" and were annoyed to find a bunch of other stuff that didn't directly answer your question.

But if you actually read the whole thing, it's clearly a meditation on the classic tradeoff of readability vs performance optimization, when micro optimizations are and aren't worth it, and how we should be deciding when to focus on one aspect or another. The single character change thing was just one particularly salient example that he uses to drive a point home.

Reading it without a preconceived idea and letting the article itself explain its purpose to me, I found it pretty well written. There's been plenty written about this tradeoff over the years and this was far from the worst I've seen.


Next step is to make it a 45 minute youtube video.


Exactly!! "Hi Astro here, you are watching this video because you want to learn how to framis and being an expert in framis I'm going to help. But first click on the subscribe button and make sure that you watch my other videos. In them I explain ...... And while we are here about to learn how to framis, lets take a quick look at the new gizmo that I bought, it has nothing to do with framis, but it's cool ..... Wow that was cool. So lets get to the framis, did you remember to subscribe. To framis you do the following (11 seconds of explain). Good luck on your framis and don't forget to subscribe. Going to close out now with a video of the cat.

/sigh


This is one of the reasons why I almost never watch stuff on YouTube. I heard people who claim that they learnt how to barbeque, renovate, take good photos etc. by watching YouTube. I’m impressed, but what I don’t understand is how they managed to either sit through or filter out this kind of chatter.


There's a difference, because something like "take good photos" is not a task with an algorithm.

If somebody wants to know how to resize an image in Photoshop, you really just want to know which option in which menu and which default settings to use, followed by short (skippable) discussions of sampling algorithms and how resolution interacts with image size. YouTube discourages this kind of efficient information delivery, as Google's incentives drive it to encourage sustained attention. It's hard to build that kind of attention on "press this button and then that one." This is analogous to a laboratory session where you really want to learn by doing, and just need the recipe.

However, learning to be a good photographer is not an algorithmic task—though it may involve them. Being good at something complex involves a comprehensive view and a value system to understand what's important and how many factors interplay. This is calls for a soft version of the academic lecture—something YouTube can do very well.

YouTube can be fantastic at the latter: just avoid it for the former.


>I don’t understand is how they managed to either sit through or filter out this kind of chatter

Short videos with specific titles, high like/dislike ratios that don't start with ultra fake enthusiasm. The back button is your friend for this ;)


I watched Joker in the cinema the other night. As the credits rolled I wondered if I should stay to see any post-credits scenes. I googled it quickly, and got this long-winded article as one of the top results: https://www.thewrap.com/does-joker-movie-have-post-credits-s...

Fucking hell, so much SEO-attracting bullshit instead of just 2 bytes (N and O). It even blahs blahs that "you are here because you want to know if the movie has post-credits scenes". And the next paragraph repeats the fucking question!


The Java standard library also includes an empty set field, so as a performance optimization it's sometimes worth checking if your set will always be empty first and using that rather than instantiating a new HashSet at all.

https://docs.oracle.com/en/java/javase/13/docs/api/java.base...


well the empty set is itself immutable, so depending on the code base the new HashSet(0) was less code.


> I'm not sure he ever got around to explaining how it saved "half a million dollars", though.

Probably the classic software vanity formula:

    profit = efficiency


FTA:

It involved some expensive re-architecturing.

It required some very expensive new servers.

It required a lot of even more expensive new licences for the third party components.

It required delaying the features the business wanted until all this work was done.


Most books should be blog posts. Most blog posts should be tweets.


> I'm not sure he ever got around to explaining how it saved "half a million dollars", though.

Re-architecting the whole system, buying new licenses for third-party components, buying new servers (all explicitly named in the fine article) can easily cost half a million.


Wish I had read this comment before the post. Thank you.


> this long-winded writing style is maddening to read!

I learned not to read/watch things that don’t get to the point

Often times they never do!


How do you know that they won't get to the point if you don't read/watch them?


Read one in four articles all the way to the end.


The comments, skimming/scrubbing, the presence of an obligatory tl;dr


no need to re-architect the program at that point, since heap pressure was reduced.

The big takeaway for me here is to learn how your target language allocates memory for new objects.


My take home is focus on the thing that matters, and there is always low hanging fruit when something flips from "don't care" to "matters"


In general this is an example of how abstractions in high level languages become increasingly leaky as production workloads grow.


> I'm not sure he ever got around to explaining how it saved "half a million dollars", though.

Me either. TL;DR. I did skim enough to get to the one-character change, and I instantly knew what the issue was: they were using Java. Ok, ok, just kidding, yes, pre-allocating what you're not going to need is premature optimization -- don't do it, except when it pays off.


All this in the name of the almighty SEO optimisation.




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

Search: