Earlier quoted context omitted.
IMO it's not just semantics, rather, GC is too general of a term if it includes ARC. In terms of performance analysis the two are vastly different. One has basically an unbounded worst case but a good average case, the other is the opposite.
Reference counting also has an unbounded worst case: what if you drop the last reference to a very large graph of objects? Then you free the whole thing, which can take an arbitrarily large amount of time.
Crystal: Fast as C, Slick as Ruby
381–390 of 439 posts
Re: Crystal: Fast as C, Slick as Ruby
#382Earlier quoted context omitted.
> It's crazy I can't tell Java and NodeJS "use the memory you need". Define the 'memory you need'? You know the computer doesn't have a cristal ball to know what latency vs memory usage trade off you want..
I wonder, could we just tell each JVM instance that it may use all of the memory on the system, and then let the OS kill the first VM that allocates more than the system has to offer? Would this get us the same semantics as those of a native application? Or does the JVM preallocate all of the memory that it is allowed to use?
Re: Crystal: Fast as C, Slick as Ruby
#383Earlier quoted context omitted.
> It's crazy I can't tell Java and NodeJS "use the memory you need". Define the 'memory you need'? You know the computer doesn't have a cristal ball to know what latency vs memory usage trade off you want..
I wonder, could we just tell each JVM instance that it may use all of the memory on the system, and then let the OS kill the first VM that allocates more than the system has to offer? Would this get us the same semantics as those of a native application? Or does the JVM preallocate all of the memory that it is allowed to use?
Re: Crystal: Fast as C, Slick as Ruby
#384Earlier quoted context omitted.
I've heard this said numerous times, so I'm going to disagree on the record. I think syntax of a programming language is a very important characteristic. A language with a nice syntax is easier to learn, easier to read and understand, and delightful to write. Crystal's syntax is a great differentiator between it and its statically typed, garbage-collecting competition.
Exactly! I guess people used to the Ruby syntax are just desensitized or don't know how much of a joy programming can be without having to type 'end' everywhere.
Re: Crystal: Fast as C, Slick as Ruby
#385Earlier quoted context omitted.
just look at hand the performance articles on Java. Just look at the hand performance articles on C... People talk about it because you can do it, not because you have to do it.
Most of the articles I see on C performance tuning are generalizable to any programming language, GC or no. Stuff like maintaining cache coherency, avoiding false sharing for threaded code, etc. I don't write java, but my impression is the articles being talked about are much more java specific than the C ones are (C specific).
Re: Crystal: Fast as C, Slick as Ruby
#386Earlier quoted context omitted.
The main difference there is: You can control the timing of when to pay that penalty. With a full blown GC, if you run into performance issues because of it, you basically have to rearchtect the whole app (with something like memory pools, which you pay by needing more RAM than strictly necessary and with a vastly more complex code). With ARC I can track down a slow memory operation to a single line of code and deal…
> IMO a full GC is just the wrong level of abstraction for anything that's timing relevant, which includes all UI threads. Hard real-time GC systems exist. In these systems, you can prove that pauses last no longer than a certain number of milliseconds. They're definitely applicable to programs with UI. Can you prove that dropping a reference doesn't free an arbitrarily large number of objects? You can probably convi…
Re: Crystal: Fast as C, Slick as Ruby
#387Earlier quoted context omitted.
Well it does, but it still doesn't do it efficiently. That was the only point I was making. But in general, yes, Elixir/Erlang will handle CPU bound tasks better than node whenever they can be effectively parallelized.
> Well it does, but it still doesn't do it efficiently. Oh interesting. Does it run callbacks on multiple threads? That's new, I haven't followed it for a couple of years.
Re: Crystal: Fast as C, Slick as Ruby
#388So, this is like Ruby's answer to cython?
No, not in any way whatsoever.
Re: Crystal: Fast as C, Slick as Ruby
#389Earlier quoted context omitted.
An occasional exception and silent corruption the rest of the time is still a lot better than silent corruption all the time - it's much easier to notice in the first place, and as long as you have one instance of the exception you have a stack trace to start from. And in practice the JVM/standard library throws ConcurrentModificationExecption pretty reliably.
> An occasional exception and silent corruption the rest of the time is still a lot better than silent corruption all the time The fundamental problem still remains, that in neither case can I use the language's semantics to guide the design of my program. > and as long as you have one instance of the exception you have a stack trace to start from Oh, really? How am I supposed to find what the problem is in the gener…
Re: Crystal: Fast as C, Slick as Ruby
#390Earlier quoted context omitted.
> An occasional exception and silent corruption the rest of the time is still a lot better than silent corruption all the time The fundamental problem still remains, that in neither case can I use the language's semantics to guide the design of my program. > and as long as you have one instance of the exception you have a stack trace to start from Oh, really? How am I supposed to find what the problem is in the gener…
I think a stack trace and an exception would help most people with a modicum of debugging skills.
What if the error is difficult to reproduce in the first place? This isn't too uncommon in concurrent programming.