Live data from Hacker News

Should I Learn Java in 2018

e4developer.com

111–120 of 165 posts

Re: Should I Learn Java in 2018

#111
post #53

Earlier quoted context omitted.

> but its actually 5-10x slower than Java and uses 5-10X more memory I am definitely against the "Java is slow" claims and think they are mostly rediculous but so is this claim. Saying "uses 5-10x more memory and 5-10x slower" goes against every benchmark I've ever run and my understanding. Mostly because JavaScript runs on several JITs (V8, JavaScriptCore, SpiderMonkey, Chakra) with different performance goals and c…

>Slowness isn't a property of the language it's a property of the runtime This is true to an extent, but look at the time and money poured into PHP and how slow it still is after all these years. Language design choices have a huge effect on how fast the runtime can be. In Javascript, objects are stored as a map of key->value pairs, and aren't strongly typed. This design requires more overhead for type checking and m…

Other benchmarks from the same group do show the memory usage and both node and Java are quite bad, as expected. Node is spectacularly bad at some, using 1.8 GB vs Java's 384M or C++'s 155M for example.

Re: Should I Learn Java in 2018

#112
post #86

If you want a low stress good paid job, where you would be able to rush home at 5pm, then yes. If you are looking for excitement, learn $hype_of_the_year and join a startup, but be ready to learn $hype_of_the_next_year soon.

I work with TypeScript, Golang and Java and I find Java the most exciting. There are a few or several libraries for everything, each of them well polished, new great features coming to Java language and JVM every 6 months, great support on every platform, many build tools to choose, that are easy to use. Things like GraalVM, local type inference, Jigsaw, SpringBoot and Jenkins make Java top language you can use these…

I played around with ES6 and TS for a year and coming back to Java was not pleasant. The functional aspect of JS/TS is something I cannot get on Java, even with streams on Java 8. Just doesn't feel right.

Re: Should I Learn Java in 2018

#113

Earlier quoted context omitted.

I'm really excited for WASM, it should be nearly as fast as native code. Java and native code aren't far apart though, so I would say 1.5-2x faster generally

Ok, but I'm worried about the garbage collector, and if it can run concurrently without interrupting the program (as a native JVM would do it).

If the Javascript garbage collecter can do it then I don't see why not.

Re: Should I Learn Java in 2018

#114
post #87

Earlier quoted context omitted.

If you tell your Java application server "here you have 4GB, use it as you wish" it will happily comply and trade memory for performance. In most of the cases it's just a matter of setting a few Java runtime startup parameters.

It's disrespectful to take 4GB if you don't need it. This should never be the default...

It's the default because in any garbage collected language you can delay taking out the trash as long as you want... as long as you have memory. The most efficient thing to do is never run the collector at all.

JS does frequent GC cycles because its unacceptable to let a webpage eat all the ram. Not sure why Go collects so frequently. Java's default IMO is the most reasonable of the three. If you have a server with 4gb the best choice is to let the garbage collector use all of it

Re: Should I Learn Java in 2018

#115
post #53

Earlier quoted context omitted.

> but its actually 5-10x slower than Java and uses 5-10X more memory I am definitely against the "Java is slow" claims and think they are mostly rediculous but so is this claim. Saying "uses 5-10x more memory and 5-10x slower" goes against every benchmark I've ever run and my understanding. Mostly because JavaScript runs on several JITs (V8, JavaScriptCore, SpiderMonkey, Chakra) with different performance goals and c…

>Slowness isn't a property of the language it's a property of the runtime This is true to an extent, but look at the time and money poured into PHP and how slow it still is after all these years. Language design choices have a huge effect on how fast the runtime can be. In Javascript, objects are stored as a map of key->value pairs, and aren't strongly typed. This design requires more overhead for type checking and m…

> This is true to an extent, but look at the time and money poured into PHP and how slow it still is after all these years.

PHP7 isn't a slow language at all - it's much faster than previous versions actually. There are servers like aerys [1] that easily handle 10,000 concurrent requests on reasonable hardware. The reason sapi (read "regular") PHP isn't "faster" is because caching and the ease of deploying more servers makes it less of a priority to stakeholders.

Like I said - this is more dependent on the libraries used than the language.

> In Javascript, objects are stored as a map of key->value pairs, and aren't strongly typed.

This is also not true - JavaScript objects are stored through a technique called "hidden classes" akin to a C like struct in most modern runtimes [2].

> This design requires more overhead for type checking and many optimizations used by strongly typed languages won't work.

This is also false, JIT engines store run time information about the object (see hidden classes above [2]) and use that to optimize by type. V8 does this a lot and monomorphic functions are much faster [3]. Inline caches (ICs) really help there.

> It's slower than java on every test.

All those programs are poorly written and are running outdated versions of both Java and Node.js. Moreover they do not represent a workload people have in any reasonable way. I think that regardless it is possible Java is faster in a lot of workloads. I wouldn't use Java nor Node.js for any of the above programs there.

> Node/JS will always use more memory for storing objects, sometimes far more because it isn't strongly typed.

See [2] and [3] - that's not how it works.

> In Java, an array of ints will use 32 bits * size plus some fixed bytes. In Javascript, each item in the array can use 2-3x the max "size" of the number, because the runtime can't figure out what type it should be.

V8 has explicit handling for arrays of SMIs (small integers) with bailout semantics. JavaScript runtimes figure this out - feel free to ask for V8 source references. Also see my answer here on a library I maintain (bluebird) https://stackoverflow.com/a/24989927/1348195

[1] https://github.com/amphp/aerys [2] https://richardartoul.github.io/jekyll/update/2015/04/26/hid... [3] https://mrale.ph/blog/2015/01/11/whats-up-with-monomorphism....

Re: Should I Learn Java in 2018

#116
post #96
post #79

I have been developing backend systems in Java, professionally, for the past 15 years. You should not base your career choice of being Java programmer or not solely on Java's popularity. There are genuine good reasons to learn niche technologies especially if you like them more. I think if you genuinely like something you are much more likely to succeed in that field and it is better for you no matter the size of the…

> Oh, and you will be working with a lot of people that barely can write a loop. That's that. I said it... It's funny although it's true. I'm not a programmer, but that's the profile of the Java developers that worked in my team. Sad, really...

I have worked for a number of companies, big and small, and this is recurring thing.

If you are a person looking to get good salary by becoming programmer but you are not really interested in programming, Java is most likely to be your choice.

You will never advance, but that's fine. If you are bad enough you will just change company and get your salary from another.

There is so much pressure to find Java developers that companies frequently forgo any sane process to check whether the person is actually qualified to do the job. With tools available like CoderPad and the likes there should actually be no excuse to do this but I guess somebody high in HR would be very unhappy seing how few actual Java developers they are able to hire after applying it.

Re: Should I Learn Java in 2018

#117
post #58

I think that its time that the enterprise switches to full stack Typescript as a much better solution for developing enterprise software. Why use two languages and two different ecosystems for the backend and for the frontend, when we can use only one? It makes hiring a lot easier too. Let's face it the Java ecosystem is stagnated and has lost a tremendous amount of mindshare in the last 7 years. The level of modular…

Why Typescript and not just JS? Static typing for a dynamic language in a dynamic environment while using many npm libraries that can return anything unexpected? You'll need tons of testing to be sure.

Typescript is highly overrated, proper testing makes the difference, not Typescript IMHO. Btw, Typescript is Microsoft, just as Github is soon, and I really having a hard time to get rid of the aversion I have for that company.

Re: Should I Learn Java in 2018

#118
Java - just like JavaScript has a lot of inertia which won't be going away anytime soon.

Anecdata: my seven person college social circle consists of one front-end dev(me), one systems dev working in C++ and Go, one all-around programming handyman, one sort of dev-ops and three backend devs who work exclusively in Java.

Large non-IT companies and their respective IT departments are first and foremost interested in technologies that work and can be easily staffed. Java fits the bill for now.

Re: Should I Learn Java in 2018

#119
post #65

Earlier quoted context omitted.

JVM uses as much memory as you allow. Use `-Xmx39m` to beat Golang.

My guess is that it won’t work with less than 1GB bc of spring boot, hibernate and all the rest of Java enterprise “microservice” goodness.

Whats different about the equivalent libraries in other languages?

Re: Should I Learn Java in 2018

#120
post #65

Earlier quoted context omitted.

JVM uses as much memory as you allow. Use `-Xmx39m` to beat Golang.

My guess is that it won’t work with less than 1GB bc of spring boot, hibernate and all the rest of Java enterprise “microservice” goodness.

IMO almost nobody is writing microservices with spring boot because its so gigantic. Hibernate isn't bad on memory use on its own.

There's a raft of more sane choices these days like Play, Dropwizard, Vert.X etc.. They all use far less resources. Spring Boot is huge because it has to support a decade of obsolete junk, its far more than just a REST app framework.

Checkout TechEmpower's framework benchmarks https://www.techempower.com/benchmarks/#section=data-r16&hw=...

(I added filters to limit to Java+Go+JS+Python and limited DB to Postgres and Mysql)

Java and Golang lead the pack, with JS a distant second and most Python frameworks hanging out near the bottom

Post reply on HN