4,107 karma · joined Feb 17, 2010 (16y ago) · 1,490 submissions
https://coderescue.com
comment 9y ago · link · parent
I was writing the Java part of a cross-platform game engine once, and I was trying to eliminate all dynamic allocations during the game (front-loading all allocations and then never touching the heap). Did some profiling and determined I'd missed something.
The allocation turned out to be in a call to get the current system timer (in milliseconds, if I recall). I was calling a Java function that returned a Java long int, probably straight from an OS call that returned a 64-bit int, and somewhere in that call it was allocating an Object.
Ripped out the Java library call, replaced it with a JNI call to a two line C function that returned the result of the corresponding OS call. No more dynamic allocations.
It's just part of the philosophy of Java to allocation things everywhere. So it's not only hard to make a GC fast for architectural reasons; the GC also tends to be worked harder by the way Java code tends to be written.
comment 9y ago · link · parent
* Access to educational opportunities as a child (the "easy" path to developing the right brain structures software engineers need)
* Lacking the first point, the extreme amount of time and the tolerance for the effort involved in "learning how to think" as an adult.
* The free time to learn to become a software engineer.
* Ideally the money to get a CS degree or equivalent.
* Raw aptitude. Some people are genuinely not cut out for it.
comment 9y ago · link · parent
It is all automated. To the point of paging you when an alarm goes off. But when the alarms go off, someone has to figure out how to fix the problem. Apparently some newer developers dug into the problem, they were able to fix it so that things were Much More Sane.
On our particular team, the server guys had just set too many alarms without really:
a) Documenting exactly why a particular alarm was potentially bad
b) Documenting what to do when a particular alarm went off
c) Really thinking about alarm thresholds -- frequently alarms were going off just because a client was using the product
The hell of oncall for our team was that we were the client team. We knew nothing about the server side. So if someone on our team was oncall and got paged, they'd basically have to call someone on the server team at 3am or whenever anyway because WTF is this stupid alarm?!
I had the Weirdest Commute Ever [1], though, and was as a side effect exempt.
[1] I live in Colorado. Amazon send me an offer to be an employee that allowed me to work from home ... but not in Colorado, because sales tax. So I rented a house on the edge of Kansas (3 hour drive), worked M-W, 12 hours/day, and drove home for the weekends. I couldn't do any work in Colorado or Amazon would risk having to pay sales tax on all purchases from Colorado. So QED I couldn't be oncall. Amazon has offices here now, so I could work for them without the weird commute. But as I mentioned elsewhere in this thread, I'm currently obsessing over finishing a game.
comment 9y ago · link · parent
Amazon is strict about a lot of things, but as far as workload -- well, I'm quite a fast developer, and I almost always was way ahead of the curve in getting things done. Very low stress for me.
Big reason I quit is that I was bored, in fact. Despite asking for more work. Despite taking on random extra team projects to create tooling to improve source control processes. And writing tools that were used elsewhere in the company. Etc. etc.
comment 9y ago · link · parent
And my experience was pretty awesome. I did hear about PIP issues, though. That does suck. I'd probably just quit if it happened to me. I have a low tolerance for crap at work.
I like the "get severance pay" strategy someone mentioned. I was only working there at all because the money and people were great.
comment 9y ago · link · parent
I had a great manager. I had a wonderful time working there. My biggest problem was that I was too fast; I'd get things done too quickly and run out of things to do. This happened even when I would ask for more work.
Otherwise the people were great, the pay was amazing, and I did most of my work from home, coming into Seattle for a few days every month to connect with the team in person.
comment 9y ago · link · parent
Curiously, they considered the salary they were offering you to be for 50 hours per week. This wasn't an upper limit; no, you were expected to do occasional overtime past 50. But 50 was the baseline.
I didn't follow through with the interview process. Screw that.
comment 9y ago · link · parent
Equity vesting was low for the first year, but they gave me a (cash) signing bonus that made up for it. Pretty much one-to-one based on the starting value of the equity, and it paid out monthly instead of waiting until the end of the year.
The cafes were awesome and the prices there were decent. I was paid more than enough to buy my own lunch. Catered food is a cute perk, but it's hardly critical.
I don't drink soda, but they had free coffee and tea. Tea is my drink of choice, so I was happy. Soda is bad for you anyway. ;)
They did have free "snacks" if you count breakfast cereal. Which many people would grab a cup full of as a snack (there were no bowls, oddly enough). There were a mountain of breakfast cereal boxes on every floor near the kitchen. But yes, they also had paid snack machines.
The oncall routines were terrible, though, I agree. Luckily I was in a strange situation and was able to avoid them.
Our team was far better, technically speaking, than what you describe. Everyone was a pretty awesome developer, including my manager, who was really awesome overall. Developers went home at night; no one was being driven as if in a sweatshop. We had game nights and played board games. Periodic team dinners (that were awesome!). It was a blast.
And I think the latter really makes the difference. There are 20,000 people working at Amazon, according to the article. When you scale that big, some corners of the org are going to suck, and some will be better.
I may someday return to Amazon, now that they have an office near me in Colorado. But I'm still working on the game that I put on hold while I worked at Amazon, and I need to finish it before I reattach the golden handcuffs.
comment 9y ago · link · parent
* Open up the compartment on top of the center of the dashboard
* Take out the rubber liner on the bottom of the compartment
* Pop the mechanical key out of the fob
* Poke the mechanical key into an unlabeled hole in the bottom of the above compartment
And bingo, your car will start.
The Kia Sorrento we have with a keyless system is much more sane: The center panel has a really obvious place to push the whole keyfob in, and it will start with a dead fob battery.
The Toyota Prius we used to own also had keyless, and also had a place to insert the whole keyfob to start the car when the battery died. And it was also pretty obvious (and labeled).
It's only the Chevy Volt where it was an absolute mystery what you're supposed to do (unless you read the manual). I don't think I would have ever guessed that you should disassemble the compartment on top of the dashboard and stick the key into an unlabeled hole. Would have been afraid of shorting something out.
comment 9y ago · link · parent
Fair enough. I'm often doing things to graphics, and the concept of using immutable data when the data is a bitmap with 4Mb of pixels, and you're trying to draw hundreds of sprites or shapes to it...well, let's just say that immutable doesn't make sense for that.
Even when I'm just working on a game, though, the more frequent allocations required by copy-on-write structures means more fragmentation of the heap and more deallocations later. Ideally during runtime nothing gets allocated.
You may even be right that the amortized speed of using immutable structures is the same as doing it with mutable data. But anything that adds a lot of allocations and therefore adds to the frequency of garbage collection will cause (or increase) jankiness in a game.
You have 16.66ms to accomplish all the work for a frame. If a garbage collector comes along and steals even 10ms, if you can't do the remaining work in 6.6ms, it will skip a frame, and users will see it.
And my current game needs to run in a browser, at least mostly. So here I am. :)
comment 10y ago · link · parent
Second, TypeScript should be considered a best practice for nontrivial JavaScript development in 2016. And pretty much any app that would benefit from Immutable.js would be "nontrivial" by that definition.
Third, everyone using JavaScript or TypeScript knows what a Map is, I would hope. The docs for it that read "Immutable Map is an unordered Iterable.Keyed of (key, value) pairs with O(log32 N) gets and O(log32 N) persistent sets." are perfectly legible to me, having never used Immutable.js, just because I had a few undergrad (not "a Ph.D.") computer science classes. I don't even have a computer science degree [0] at all.
I actually personally despise lowest-common-denominator docs: Docs that tell me "what a Map is and how to use it" when what I want to know are things like what its get and set performance implications are, and whether you can iterate over it, and whether that iteration will be ordered, and so forth.
Sure, create a user's guide, but don't pick on the reference manual for being concise.
FWIW, I'm not a big fan of Immutable.js or immutable structures at all. I'm too performance-oriented to want a layer like that between me and the underlying data structures. Criticize it for being unmaintained [1], sure, but not for having docs that aren't aimed at beginners.
[0] My degree is a B.S. in Cognitive Science [1] https://news.ycombinator.com/item?id=13051458
comment 10y ago · link · parent
A lot of people still think using WordPress or even Rails for site generation is fine, but both are hard to scale. And if the site is small or academic, it will fall over with not too much traffic.
I wrote a rant [1] about this a couple of weeks ago. I can guarantee that my site will never have a "Database Connection Failed" error (now), because there's no database backing it.
Even better would be if I moved hosting to S3/CloudFront. Dirt cheap, and Amazon isn't going to fall over even if a site hits Reddit's front page. I might not like the bill I get at the end of the month if it really goes crazy, though.
[1] https://realmensch.org/2016/11/22/drupal-is-dead-long-live-s...
comment 10y ago · link · parent
See: http://www.goodboydigital.com/pixijs/bunnymark/ -- click or touch to spawn bunnies.
Run it on mobile. On my Nexus 6 it stays pretty smooth around 10-15k bunnies, sometimes more. I've seen it glitch as thousands of new bunnies are added at once, but in a well-written game you'd create a "bunny pool" and pre-create all of them so that you could add them without as much overhead.
It's actually a bit jerky on Firefox on my "ultra low power" laptop, despite having a recent Intel i7 CPU, but Chrome is smooth up to 10K bunnies. On my gaming computer, heh, I can go over 100K bunnies without it dropping below 60FPS. That's a lot of sprites, period.
At some point I'll probably port my game from Phaser to PIXI. Like I said, I'm stuck using a browser for at least part of my game. If I were creating a 2d game that didn't require a browser, I'd probably use something else: Unity, maybe, or I'd look around at the other 2d and 3d engines out there to see what's available. I also have an existing 2d engine that I might bring up to date.
In your sample on w3schools, I ran some profiling, and it's firing off dozens of JavaScript callbacks per second, doing who-knows-what. Analyics, probably? Also, as mikewhy pointed out in a sibling comment, transform:translateX() gives you hardware acceleration. Otherwise it has to rebuild the DOM on Every Single Frame. I pulled the code to a local server without the w3schools extra cruft and it was much better, but still not perfect. Converting to using tranform:translateX() made it silky smooth.
In any case, good luck.
comment 10y ago · link · parent
I've developed a half dozen apps in Ionic Framework, and they all operate at a silky smooth 60FPS. I don't end up with performance issues because I'm:
* Using CSS for animations
* Not using JQuery for things you should never use JQuery for in 2016 because they're too slow on mobile
* Not piling on tons of verbose frameworks to accomplish every little thing and therefore slowing down the JavaScript engine as it ends up with multiple megabytes of code
* Limiting asset sizes so we don't overrun mobile memory limits
* Generally optimizing the code so that I'm not wasting time or creating 16 intermediate arrays in every data conversion/manipulation because the functional approach looks so pretty
I understand you were "just learning JS development." It may actually (ironically) take more of an expert to get good performance out of Cordova than it does to produce a decent native app.
But everything I did above should also be standard practice for creating any web pages, since otherwise performance will in fact be crap on mobile. So it's really just web development best practices.
No, it's not that there are limitations in Cordova. It's that writing web pages for mobile is harder than for desktop, but that when you do it right, it makes for a good app experience as well.
Not to mention React Native and NativeScript, which will get you full speed on mobile with native controls.
comment 10y ago · link · parent
And yes, we also get a lot of people (myself included) who are escaping from California for various reasons. Considering the number of people who leave California, it's almost surprising that California's population is still growing, though I believe it is.
comment 10y ago · link · parent
* I have an IRC client installed, yet never use it except in those few cases where the community I need to talk to only uses IRC.
* The few times I've had companies try to make IRC the dominant in-house private communications channel, it's failed utterly despite a lot of people signing on to begin with.
* IRC doesn't make file transfer easy.
* IRC doesn't support voice chat natively.
* IRC doesn't support integration with desktop, mobile, and email easily.
* IRC doesn't keep a forever-history that is instantly available when someone connects to a channel (if it does, then my clients haven't supported such a thing).
* Companies that need to send notifications to your work group (things like Rollup.js or a continuous integration server) all seem to integrate with Slack. Not so much IRC.
* I finally installed Slack to chat with a couple of local tech communities, and quickly discovered that Slack is in fact awesome, in that it does all of the above.
Before you tell me how this client does X or that client does Y, well, I've tried several, and none did all of the above well. Even if there is such an open source client out there, well, the Slack client does the job well and everyone already has it installed.
And frankly I don't want Yet Another Chat App to install. The fewer the better. This is a domain where network effects rule.
comment 10y ago · link · parent
Goroutines are not threads. It's named after a "coroutine," which is an async function (like a generator) where you can pause execution of a task (to wait for IO, for instance) and then resume it at a later time. Coroutines give you implicit async/await style programming, without having to use extra keywords. The language Lua supports coroutines natively, for instance, including explicit yields to use them as generators, if you need. Goroutines give you coroutines with a bonus: Actual thread hopping (and multiple channels of communication possible, so you can effectively have more than one "yield" channel).
If you have 400,000 Goroutines running on 4 CPUs, your Goroutines can task switch between those 4 CPUs using 4 OS threads (or 8, or whatever number you determine is best for your app) as their IO events queue up. It is async, and each Goroutine has around 10k of RAM overhead, not counting data you're storing yourself (it varies by architecture, but that's a reasonable estimate; I've seen between 6k and 16k on different architectures).
Go is better async than JavaScript, because a Goroutine started on one thread can get processed on another, so a few thread-hogs won't block a task. A single Goroutine could cycle between all your worker threads, in fact, though I think it tends to stick with a single worker thread ("thread affinity"). It's probably the most asynchronous you can get in a language (only the Erlang VM/Elixir is in the same class of language, as far as I know).
Do you think PHP could handle 400,000 concurrent WebSocket connections on one server? Go can. How much RAM would you need to handle 400,000 CPU threads? Maybe 64Gb instead of ~8Gb in Go? Wouldn't CPU switching alone be starving most of the threads and redlining the CPU at that point? In my experience you start seeing serious slowdown around 5,000 threads. I'd guess you'd need 50x as many servers to handle that many connections on PHP. Maybe 100x. You need to support a million users? Is it better to have 3 servers or 300?
> The things you complained about in another language were fixed/removed years ago but you say it's still just as bad.
PHP is architecturally single-thread-per-request. Full stop. Even PHP 7 and HHVM. That simply doesn't scale as well as async, as I described above. The complaints I made were why I bailed on it years ago. I'm sure PHP has gotten a lot better than it was when I used it, but given that it still misses the mark architecturally, I have zero motivation to give it a second chance.
But given that NodeJS has far surpassed it in community support (as well as by many performance measures -- HHVM is quite fast at raw processing speed now, though not as high throughput because of the lack of true async), why is PHP still relevant except to continue to maintain existing code bases? (I've worked with several of those as well -- Joomla and Drupal in particular -- and neither was something I'd consider worth using, having looked at their internals and terrible performance. Joomla was a complete disaster; Drupal only slightly better.)
>Every failure or less than great situation in your favoured languages has just been fixed in the last few years.
Your point? Even if they all were only better as of yesterday, they're still better. Or are you defending your choice of a few years ago?
And actually, Promises have been available using polyfills for years. The proposal was made at least six years ago; I can't find the exact date, but I found a reference added to the CommonJS wiki in 2010 [1]. The Q library dates back to 2010 as well. [2]
I concede that there may have been a period of time where PHP was better than JavaScript, by the criteria I'm using today, because PHP did improve a lot after I first encountered it, while JavaScript only more recently developed its compelling advantages. It looks like Node was released in 2009? In 2009 I was using OpenResty (Nginx+Lua) to do my (small amount of) server work, which can still be more performant than both Node and PHP. But NodeJS has shot past in terms of community support, which is critical, TypeScript is awesome, sharing code on client and server is awesome, isomorphic rendering is awesome, and performance is good enough (compared to Lua) that NodeJS just wins for me, big time. Except when I need the extra speed, and for that I use Go.
Go is a brand new language, relatively speaking. So of course they're still making major improvements. Performance has already surpassed HHVM, even for raw compute tasks. It's a better fundamental architecture, giving it an edge, and performance will likely improve still more, though they're already hitting diminishing returns: Some of the worst case performance they see now may get 2x-4x faster, but typical app performance is probably only 10-20% short of optimal. I mean, they're already beating C++ on the server. How much better can they go?
Use whatever language you want; if your background and/or current job is PHP, so be it. It's not as bad as it was 10 years ago, for certain. Just don't expect anyone to pick it up based on its merits. There are too many other, stronger options available today.
comment 10y ago · link · parent
> "callback hell"
It can be ugly to look at, but it's fast.
And I thought we weren't using references to 10 years ago to judge a language? Promises minimize callback hell with a far better (more functional) interface, and async/await (usable today with transpilation) banish it entirely.
[1] https://gobyexample.com/goroutines
[2] Preliminary results: https://www.techempower.com/benchmarks/previews/round13/ -- Go has been seriously optimized over the past six months, so the last round of results is less impressive, but still strong: https://www.techempower.com/benchmarks/
comment 10y ago · link · parent
This is still true today, and this fact alone makes it not worth trying out as a server language.
comment 10y ago · link · parent
I think OO is a hard concept to get right. I know it took me years to master, and one of my epiphanies about OO design is that it's not always appropriate. Yes I can tell you the best OO approach to a problem, but I can also often tell you a better approach that isn't OO.
comment 10y ago · link · parent
That's certainly part of it. JavaScript suffers the same hate today -- amateur and junior developers produce thousands of lines of crap per year, and people blame it on the language.
But PHP itself is just a mess. I'm an experience developer (about 30 years at this point), and about 12 years ago I decided to do a volunteer project for a nonprofit in PHP. Finished the project and the nonprofit used it for at least 10 years -- they may still be using it for all I know.
Never. Again. I can't stand PHP and I will avoid its language and ecosystem like the plague. Even if they've fixed some of the problems in the core language and added types, the "standard" libraries were a random pile of mismatched garbage where the mysql_xxxx functions could have parameter signatures in different orders than the pg_xxxx versions. Maybe they've fixed that as well, but they'd have to break backward compatibility in pretty awkward ways to achieve that.
I don't even remember all the other things that tortured me, but it wasn't fun.
And it's not asynchronous. There's not even a good reason to use a synchronous language for web development today. Not to mention the ease of running NodeJS code in a debugger, or running tests in a browser and debugging it there...
I'm using TypeScript and Go for all my web related code moving forward. Something better comes along, and I'll consider it. But PHP was just a nightmare. (Elm on client? Maybe, under the right circumstances?)
comment 10y ago · link · parent
:P
My "a few sigmas above average" comment was to just point out that I'm not typical. It's literally true, though. I really am that good. At least when I'm not writing comments on HN. ;)
Relative to Kent Beck: I've never met him, much less worked with him. But being famous doesn't automatically make you a top 0.1% developer. A great manager and process person? Sure, I'd buy that, based on his books. But based on the relative skill of developers who I've encountered through my career, I'm at least top 1%, and maybe 0.1%. I've met hundreds of developers, and only a very few were in the same league.
I did read Extreme Programming when it first came out. I actually feel that many of the practices in XP, including test-first and pair programming, are actually far more important for average to below-average developers. I think Kent Beck himself said that XP was best for broad-but-shallow problems (things like accounting software with a million simple rules). Broad-but-shallow just doesn't require the same strength of programmer to conquer -- though it does require good process, especially if your team size (and breadth) is large, which is Beck's strength.
comment 10y ago · link · parent
I may have gotten a technical interviewer because I can list a half dozen people who know me who work at Google, most of whom can directly vouch for me.
Not sure why the OP got an unskilled reviewer, but if they didn't list references inside the company, they may have been thrown in the "random unknown applicant" bucket.
comment 10y ago · link · parent
What's completely wrong with the situation is that the recruiter was saying "wrong" when he was giving detailed answers. The right solution is to have a non-skilled recruiter take careful notes, asking the candidate to repeat if necessary, in the cases where the candidate insists they know the answer.
Then only in cases where the candidate can't answer a question should it be marked as "wrong." In other cases the answers should be run past someone knowledgeable.
I've gone through a phone interview with Google myself, and it was nothing like this: I spoke with a real, skilled engineer, and there was nothing like a "gotcha" question where I had to guess the exact term he meant. Well, except where he asked "I bet you know what my next question is" and I didn't guess "How can the algorithm be faster?" But he didn't count that against me. :)
comment 10y ago · link · parent
They offered an in-person interview, of course, but I declined when I found out that they were only hiring for Google Payments in Boulder. I'm sure the job has interesting aspects, and maybe my imagination just isn't up to the task, but I have a hard time figuring out how I wouldn't go insane with boredom working on a system that just moves money around, not to mention frustration from working with the extra regulatory/process restrictions that must be in place to keep compliance up...