2,464 karma · joined Jun 25, 2020 (6y ago) · 493 submissions
comment 3y ago · link · parent
{
std::vector<std::string> tokens = tokenize(line);
// do work with tokens
}
which you could change to std::vector<std::string> tokens;
{
tokens.clear();
tokenize(line, &tokens);
// do work with tokens
}
Combined with your suggestion to use std::string_view, this would mean only O(1) allocations across the program for this part of the code.comment 3y ago · link · parent
comment 3y ago · link · parent
If you look at some of the Rust threads on HN right now [0], you find many commenters claiming that there is no reason to replace C with Rust. It could be a vocal minority, but there's still a sense that "not everyone is on board".
comment 3y ago · link · parent
Like, those are all examples of companies which failed to adapt to some new reality. This announcement is Google seeing AI as the next thing and proactively engaging with it.
comment 3y ago · link · parent
In my case I was lucky. At the age of 25 I was also living paycheck-to-paycheck, and did an obnoxious 5 week trip around Europe which left me broke and unable to make rent. I had to ask my father for a loan to get me through, and the whole experience of that was humiliating. Especially because I had built up a self image of being financially independent. Within a week of that humiliation I had set up a planning spreadsheet and set up savings goals to never have to beg for money again (and it worked).
Point being that, for me at least, setting up the spreadsheet was the easy part - the hard part was deeply having the psychological shift of "I really need to save money".
comment 3y ago · link · parent
We have two groups of people - tech workers who have a generally great working environment, and shift workers who do not. The idea that in our advanced society we should base our expectations on those who are currently doing worse is frankly absurd. Our aim should be for _everyone_ to have the work-life balance that tech workers have now.
comment 3y ago · link · parent
comment 4y ago · link · parent
I think this is mischaracterization of why people choose Rust (and FWIW it comes across as condescending). People choose Rust over C++ partially for the same reason people write unit tests. We accept that no matter how good we are at writing software, we are still fallible, and so we introduce structures around our work to minimize the fallout from that fallibility.
comment 4y ago · link · parent
Employers don't know ahead of time which employees will leave and which will stay. In order to improve their employee retention, employers have to pay _all_ of their employees more, not just the ones that eventually will leave. This changes the math entirely.
For example, suppose it costs 50% extra to replace someone who leaves. In retrospect, sure, giving the sole employee who leaves a 10% raise each year to retain them makes sense. But if you have to give all of your employees a 10% raise per year, just to retain that one person, it doesn't make financial sense anymore.
To be clear I'm not endorsing this system at all! But from a pure financial perspective it makes sense to me and is why, I suspect, it persists.
comment 4y ago · link · parent
Because of the per-country limit of 7%, these queuing dynamics generally only affect people from countries with large number of applications (India, China). But sometimes there will be a backlog for all countries. The current forecast is that there will be a backlog in 2023 in the EB2 category for all countries.
comment 4y ago · link · parent
- The cost of sponsoring someone for a green card ($50k?) is low compared to engineering salaries.
- Many companies like Google have great retention and the probability that an employee leaves after getting green card is low.
- Companies that are worried about retention often have employees sign a reimbursement agreement when starting the GC process. Something like, if you leave within 2 years of getting the GC you pay a prorated portion of the legal fees.
- In a tight labor market, GC sponsorship is another benefit like compensation, and companies offer it to hire good people. Over the last few years companies like Amazon have changed their GC policy to sponsor folks from day 1 of employment in order to hire people for whom a GC is that important.
comment 4y ago · link · parent
comment 4y ago · link · parent
Is there a concern with these kinds of micro-benchmarks, where you repeatedly do the same small operation (matching the same regex), that your results will be skewed by the branch predictor, CPU caches, etc.?
comment 4y ago · link · parent
Suppose you have bounds checks on array accesses, but your program is 100% correct and the panic case is never hit. Doesn't the branch predictor essentially make the bounds check free? Or very low cost at least?
comment 4y ago · link · parent
The goal of Carbon is explicitly _not_ to be a new general purpose programming language. In the docs, the authors even advise people to use Rust instead for greenfield projects. The goal of Carbon is to support migrating existing C++ codebases to some new safer language.
comment 4y ago · link · parent
I think on Hacker News it's really fashionable to criticize Go, and this has led to a culture where Go gets significantly more negativity than it deserves.
As technologists, one of our most important jobs is to see through such fashions and judge languages/tools/technologies based on their actual merit.
While gauging sentiment about things on a forum like Hacker News is generally really helpful, it should not be the main basis of our decisions.
comment 4y ago · link · parent
> But there's also something to be said for being able to open up a blank file in a blank folder, writing some lines of code, and running a command to execute said code.
E.g., in Go the tooling is so good that you can just create a file and run it using `go run .`. This is sort of the point the author is making? No need to worry about build systems, dependencies, etc.