Live data from Hacker News

Brand new Scala-lang.org

scala-lang.org

111–120 of 131 posts

Re: Brand new Scala-lang.org

#111

Earlier quoted context omitted.

Put and lookup are much slower vs ju.HashMap. For most use cases where the system is already multithreaded the parallel collections don't gain us anything. If you have a large read-only map being read by multiple threads (doing random lookups) ju.HashMap leaves both mutable.Map and immutable.Map very far behind. Scala is great, but the Map performance lags. I'm not the only one who has noticed. Try googling "Scala ma…

java.util.HashMap is not thread-safe, so using it in the context of multiple threads reading from it is less than ideal. The great thing about Scala's immutable HashMap is that in terms of concurrency it is worry-free. You couple it with an AtomicReference and presto, you've got a non-blocking, concurrent HashMap. I work on a really high-volume web service that's built on top of Scala. The performance of Scala's immu…

Scala's immutable hashmap is about 4-5x slower than ju.HashMap for reads and 6-7x slower for inserts.

Re: Brand new Scala-lang.org

#112
post #99

Earlier quoted context omitted.

Put and lookup are much slower vs ju.HashMap. For most use cases where the system is already multithreaded the parallel collections don't gain us anything. If you have a large read-only map being read by multiple threads (doing random lookups) ju.HashMap leaves both mutable.Map and immutable.Map very far behind. Scala is great, but the Map performance lags. I'm not the only one who has noticed. Try googling "Scala ma…

You should take a look at scala's OpenHashMap - a mutable hashmap in the scala standard library that is often as fast as ju.HashMap. Link to scala doc: http://www.scala-lang.org/api/current/index.html#scala.colle...

I have used OpenHashMap, but the results are mixed sometimes is much faster, other times it's much slower. It really depends on the use case.

Re: Brand new Scala-lang.org

#113
post #59

The new homepage gives Scala a very classy feel! Nice!! This comes as a (personal) advise to all my fellow startups here. Dear dudes and dudettes, I've been a long and hard fan of the 'Get shit done' mentality and I still am. From my past experience running Rails and Scala, I'm going to tell you what exactly you should do for your startup: 1) If you KNOW FOR SURE your startup will face a lot of page views, requests e…

Nice comment. Question: can you recommend any libraries/frameworks for interacting with the database. E.g., something like the ActiveRecord in rails, or perhaps hibernate?

Re: Brand new Scala-lang.org

#114

Earlier quoted context omitted.

I guess it depends on your team. We didn't have much trouble with Java guys picking up Scala very quickly. Scala performance is on par with Java if you keep your wits about you, but you do have to be mindful of the code you write. Scala collections (esp. maps, doubly so for immutable.Map, but also mutable.Map) are (currently) slower than the standard Java collections, but it's easy to use an implicit conversion wrapp…

> For comprehensions can also cause some overhead, so if you're really pressed for performance a while loops is always an option. In most cases in which I need a while loop, I use a tail recursion instead. You can keep your code free of side-effects that way and the compiler generates code equivalent to a while loop.

> In most cases in which I need a while loop, I use a tail recursion instead. You can keep your code free of side-effects that way and the compiler generates code equivalent to a while loop.

Hear, hear! I can corroborate this statement and have benchmarked it quite a bit in the past. If you can mark a method as @tailrec in scala and the compiler does not complain, it will go as fast as if it were written with a while loop. And in many cases it will feel cleaner as well.

Of course, not everything writes itself nicely in a recursive style, for this you should use while if you need the performance. Don't be afraid, scala is after all a mariage between OO, functional and bits and pieces of everything nice. It's still there for a reason.

* the @tailrec attribute is not necessary but forces the compiler to complain when your recursive method is not, in fact, tail recursive. It's also good documentation that a developer who makes changes should keep it tail recursive because it's sensitive.

Re: Brand new Scala-lang.org

#116
post #59

The new homepage gives Scala a very classy feel! Nice!! This comes as a (personal) advise to all my fellow startups here. Dear dudes and dudettes, I've been a long and hard fan of the 'Get shit done' mentality and I still am. From my past experience running Rails and Scala, I'm going to tell you what exactly you should do for your startup: 1) If you KNOW FOR SURE your startup will face a lot of page views, requests e…

># Generally, on an average, 1 line of Scala = 10 lines of Java. That's less maintainable LOC (it can be argued otherwise, but just assume it's a good thing)

># Performance. Now this is where Scala really shines. Scala's base performance is almost near Java's in most real world scenarios.

Scala's great, but don't overhype it. I just finished re-writing a mid-sized (~30k LOC) API app from Java (Play 1) to Scala (Scalatra). In this case the code size was reduced to about 40% of the original, but we needed about 50% more CPU and 100% more RAM to get comparable performance.

It was still well worth it - aside from the reduction in the size of the code there are additional maintainability benefits from immutability and other nice aspects of idiomatic Scala.

Re: Brand new Scala-lang.org

#117
I've always been intrigued by Scala as everyone says it's super fast but I was put off by the fact it had 'Java' in the description. But, looking through the new site (looks brilliant!) I think I'll take a look as it's got a nice syntax :-)

Re: Brand new Scala-lang.org

#118
post #59

The new homepage gives Scala a very classy feel! Nice!! This comes as a (personal) advise to all my fellow startups here. Dear dudes and dudettes, I've been a long and hard fan of the 'Get shit done' mentality and I still am. From my past experience running Rails and Scala, I'm going to tell you what exactly you should do for your startup: 1) If you KNOW FOR SURE your startup will face a lot of page views, requests e…

Good points. However, regarding performance, you can get a lot of mileage by moving over to JRuby + Torquebox (cluster) and further improve response times by adding a caching layer and maybe throwing in Angular.js / Backbone.js (templating moves to the client side). So the goodness of Rails dev speed and the performance of JRuby is a decent combo IMHO. But like you mentioned, if you need to scale beyond that Scala is a good option.

Re: Brand new Scala-lang.org

#119
post #90

Earlier quoted context omitted.

I'm not a recruiter per se, but I have been recruiting. On the question " do Python shops hire non-Python programmers because they have to? ", from my experience the answer is Yes , but the reasons are twofold. On one hand, yes, it is harder to find Python developers and it makes no sense for a company to restrict itself to such a limited pool. On the other hand it is also a matter of culture - companies that use les…

Interesting points. A follow-up question for you regarding your belief in the focus on quantity over quality . In your opinion, do you think that the perceived focus on quantity over quality is representative of the culture of some Java shops or a function of the Java language itself (a necessity for more programmers due to the nature of the language)? I've run one of the larger Java Users' Groups in the US (Philadel…

I think it's about the culture. Many Java shops are simply assembly lines.

And really, it's logical - if you want to build an assembly line, you pick a popular language for which you've got not problem in finding cheaper developers.

This isn't representative of all Java shops btw. And if you've got a different perspective due to your involvement in a JUG, you do have to keep in mind that people (or companies) joining a JUG do so because they want to be a part of a community, or for the learning experience, which is why JUG members are not representative.

Re: Brand new Scala-lang.org

#120
post #59

The new homepage gives Scala a very classy feel! Nice!! This comes as a (personal) advise to all my fellow startups here. Dear dudes and dudettes, I've been a long and hard fan of the 'Get shit done' mentality and I still am. From my past experience running Rails and Scala, I'm going to tell you what exactly you should do for your startup: 1) If you KNOW FOR SURE your startup will face a lot of page views, requests e…

Nice comment. Question: can you recommend any libraries/frameworks for interacting with the database. E.g., something like the ActiveRecord in rails, or perhaps hibernate?

The closest I can think of is something called 'Slick'. It has a bit of a steep learning curve, though. Also the docs are a bit scattered.

http://slick.typesafe.com

Post reply on HN