Hacker Newsnew | past | comments | ask | show | jobs | submit | sicp-enjoyer's commentslogin

> the failure rate is too high

The rate dramatically changes with demographic, for example many of those were married young and did not complete education.

> who you pick to marry

The quote doesn't say whether :) Married men also tend to make more money and work for longer periods of time. There is a cynical view of whether that's good or not, but 40-50 year old single men don't seem to be a particularly successful demographic.


Married men live longer, but the last years are mostly garbage anyway. If you’re co-dependent or really need that companionship, autonomy and agency might not be what you’re optimizing for. Cashflow and wealth doesn’t buy love or happiness, only choices and freedom. Optimize accordingly.


Your comment cautioned against marriage for its "cost". Now you are talking about lifestyle preferences.


My apologies, sometimes I forget connecting the dots must be more explicit. Tell me the lifestyle of someone who has their assets split in half and having to provide alimony/maintenance for (possibly) the rest of their partner’s life. I can only speak for my circle of social acquaintances, many divorced, all living terrible lifestyles because of the financial burden of divorce. Some got away with only losing half their assets and having to provide $3k-$5k/month post tax to their ex partners. Some, worse. One expects to have to work to death, and can never retire.

I’m just working back to first principals. You can be happy without the legal Russian Roulette of marriage is my overarching thesis, and I apologize again it took so many words to arrive at my point.


Now you're talking about financial burden again. I don't wish the situation you are describing on anyone, and I am sympathetic to making choices to avoid that happening. I don't think that is inconsistent with my other comments.

Just to add, here are a few other things that also limit your day to day freedom and add some risk of legal nightmares:

- operating a business

- owning a home or other building

- running for political office

- raising a child

- using a professional license (medical, law, civil engineer, etc)


>The rate dramatically changes with demographic, for example many of those were married young and did not complete education.

So OP, a 28 year old male still in the process of completing education?

I agree with ianai and toomuchtodo, marriage can wait (assuming one is even interested in it) until you've made your place in the world and have time and room to think about such things.


Conversely when i was in a similar situation, my marriage was the thing that helped carry me through. She was a rock and gave me the kind of support i wasnt really getting anywhere else. But we also shared the journey (hers and mine) and that experience in itself is more valuable than my degree (which i neither use nor rarely reference).

IMHO the reality is a marriage os neither something required nor something to avoid, it lies along side professional life and again IMHO, recommending one to get married or not doesnt deserve a place alongside how one should pursue their career goals. They should be equally pursued in a balanced fashion suited to the individual.


I have noticed that Phd holders usually advise buckling down and dealing with whatever abuse or bureaucratic nightmares are required to finish.

I think I agree with 1 year out, but I would be surprised if this hasn't been going on for longer.


This is quite unfortunate. The way to get a really good hash table is by enforcing a bunch of simplifying assumptions (power of 2 sizes, sentinel values, etc). But the C++ committee has to make the "one true table" for everyone.

std::map actually seems to fit this role better. It works reasonable well for many workloads and types without tuning a bunch of parameters.


All of <algorithm> uses ordering operators as well. If you have a "regular" type with proper comparison and assignment operators, it works for everything, container keys, sorting, etc, etc.


> so hash map will generally be faster in this regard.

Complexity is not a measure of runtime. The performance drawbacks for std::map have to do with cache, not O(log) vs O(1). log(billion) is 30. And that's exactly how many comparisons you have to do, not a constant multiple of that.

With an open addressing hash table, who knows how many steps you will need to find an element. It's even more questionable if it does linked list chaining.

> binary search tree.

It's usually a red black tree and maybe could be a b-tree? "Search tree" is accurate.


> maybe could be a b-tree?

IIRC the complexity requirements of std::map preclude a b-tree (or require a binary tree). Though I don't remember the exact reasoning.

abseil's website makes the same claim, though also without justification:

> B-trees have a different implementation from STL std::map containers, which require binary trees commonly implemented as red-black trees.


> It's usually a red black tree and maybe could be a b-tree? "Search tree" is accurate.

I mean, I haven’t write red black trees for a while, but it is a type of binary search tree, as far as I remember, isn’t it?


You are correct. Sorry if I am being pedantic. I was also trying to suggest it could be a b-tree but others have pointed out that it doesn't quite fit the spec.


Do you know about std::unique? Generally sets are a poor tool for removing duplicates.


Doesn't std::unique only generally work on consecutive items, and effectively requires the items to already be in a container (or at the very least have access to iterators to the items)?

If so, that sounds fairly limiting to me (i.e. potential extra storage - of duplicates, sorting required, etc).


This person is already putting sets inside vectors, so I don't think they are worried about storage.

But yes, you either need to stop occasionally and remove the duplicates or use a set, if the storage is prohibitive.

Otherwise in terms of performance, sorting and unique is much faster than inserting one element at a time in a set.


Can many hashes be combined quickly in a uniform way? This is another benefit of `<`, it composes.


> Can many hashes be combined quickly in a uniform way?

The XOR operator?


All pairs of {x,y} with x==y or hash(x)==hash(y) would hash to the same value (0). That's seems suboptimal.


If you do that 10 times for all members of your struct, do you get good uniformly distributed keys?

This post doesn't think so: https://stackoverflow.com/questions/5889238/why-is-xor-the-d...


XOR is a bad way to do it, but there are ones that work much better that are described in answers to that post, and it's what other languages use in similar situations (e.g. tuples in Python and C#):

https://github.com/python/cpython/blob/71db5dbcd714b2e1297c4...


Yes, and eventually you start computing another hash of the buffer of the concatenated members. I'm not saying it can't be done, I'm just comparing it with recursive memberwise comparison.


You need both access patterns (otherwise you do a double-lookup to insert a default value) and C++ already provides both.


Whatever is implemented by operator[] in a given language is going to be implicitly encouraged by the language, and that's what most novices will use.


> developer time is a significantly more expensive resource than compute

This also presupposes that making a fast program is a lot more work. However poor performance is usually due to negligence rather than a lack of optimization effort. All you need to write reasonably fast code by default (without micro-optimizing) is:

1. a good knowledge of available algorithms 2. a good understanding of the problem

1. Is a one-time investment on the programmers part that benefits all future programs they write. There is no marginal cost to being familiar with what's available in <algorithm>. 2. Has a marginal cost, but it's probably a time saver anyway. Measure once, cut twice.


My goto build system is:

- make

- Google's closure compiler (standalone Jar)

- imagemagick

It builds fast and never goes out of date.


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

Search: