News for hackers. Stuff that matters.
Re:Perl 6 Is Slower Than My Fat Momma by latenightcoding on Friday April 08, 2016 @09:33PM (#11459440)
I really want Perl 6 to become mainstream. I am assuming that this post talks about slow startup time, which is not a big concern since now a days everything seems to be a long running process.
Re:Perl 6 Is Slower Than My Fat Momma by raiph on Saturday April 09, 2016 @10:34AM (#11461385)
Most recent simple comparisons I've tried or seen others try between the code/compilers of Perls 5 and 6 show the latter starting and executing about one or two orders of magnitude slower.

Regardless, Perl 6 is fast enough for some use cases, has been steadily improving for years (around 3x to 5x per year over the last 5 years), and looks set to do so for years to come.

Re:Perl 6 Is Slower Than My Fat Momma by lemiant on Friday April 08, 2016 @09:18PM (#11459392)
Those concurrency features are amazing! Are there any other languages like that?
Re:Perl 6 Is Slower Than My Fat Momma by manigandham on Friday April 08, 2016 @09:29PM (#11459425)
They seem pretty standard for today. C# is pretty great at it.
Re:Perl 6 Is Slower Than My Fat Momma by raiph on Saturday April 09, 2016 @11:47AM (#11461741)
What's the C# equivalent of the concurrency features listed in the OP:

1 `await` (iiuc this is fundamentally not the same as the C# feature that uses an `await` keyword) and `start`.

2 "transforming ordinary code in to concurrent code with a single method call".

If you could post brief C# fragments corresponding to these two, or at least the latter (which I find the most interesting), that would be appreciated.

----

Fwiw Jonathan Worthington, arguably the lead designer of Perl 6's concurrency features (following guidance by Larry, Damian etc), spent years teaching C# parallel, async and concurrent coding before the Perl 6 features were fleshed out.

Re:Perl 6 Is Slower Than My Fat Momma by manigandham on Saturday April 09, 2016 @10:35PM (#11464578)
1) It's the same, just with finer control in C#. `await` means you're waiting for the result of a method but not blocking the thread/CPU from doing something else. These awaits use a `Task` which is a handle to get the completion status and final result. `Task` is the object returned by an async method. To start 3 methods in parallel, instead of awaiting each one, just get the task objects and wait for all at the end.

  var task1 = GetSomethingFromDatabaseAsync(1);
  var task2 = GetSomethingFromDatabaseAsync(2);
  var task3 = GetSomethingFromDatabaseAsync(3);
  
  Task.WaitAll(new[] { task1, task2, task3 });

2) This is even easier and it's just talking about doing a loop over multiple threads. This can be handled by using the above style - launching a task in each iteration and waiting for them all to complete - or just using the Parallel convenience methods to launch the loop.

  var somethings = new List<int> { 1, 2, 3, 4, 5, 6 };
  
  Parallel.ForEach(somethings, i => { Console.Write("Number: " + i); });

All of this stuff has been around for years with async/await baked into the language in C# v5 and the Task Parallel Library has been around even longer. The current System.Threading.Tasks namespace has a good overview of all the capabilities: https://msdn.microsoft.com/en-us/library/system.threading.ta...
Re:Perl 6 Is Slower Than My Fat Momma by raiph on Sunday April 10, 2016 @06:06PM (#11468402)
> 1) It's the same, just with finer control in C#. `await` means you're waiting for the result of a method but not blocking the thread/CPU from doing something else.

Thanks. `await` in Perl 6 is blocking. I'm guessing Task.WaitAll maybe does (some of) what `await` does in Perl 6?

> 2) This is even easier and it's just talking about doing a loop over multiple threads. ... Parallel convenience methods

Are you saying ordinary synchronous C# code looks like this:

    ForEach(somethings, i => { Console.Write("Number: " + i); });
And then, to parallelize it, folk refactor by prepending a `Parallel.`?
Re:Perl 6 Is Slower Than My Fat Momma by manigandham on Monday April 11, 2016 @05:21PM (#11475208)
> Thanks. `await` in Perl 6 is blocking. I'm guessing Task.WaitAll maybe does (some of) what `await` does in Perl 6?

Depends on what you're trying to do. `await` is just a keyword that means the CPU pauses this method until the result comes back and does some other stuff meanwhile. You can omit the keyword and method completes immediately while the other stuff gets done automatically if you dont care about the result or whether it actually finished/errored/etc.

In C#, you can use Task.WaitAll() which will block the current thread until all the async tasks are finished or use Task.WhenAll() which itself is an async task that returns when all the tasks you pass in are finished (and probably the better option in actual production code).

> Are you saying ordinary synchronous C# code looks like this:

No, normal foreach is a language keyword/construct that just looks like:

  foreach(var item in someListOfItems) {
    DoSomething(item);
  }
Parallel is a static class that implements parallel processing and is part of the TPL (Task Parallel Library) that has been available for years before even the async/await keywords were built-in. You can use them both in combination to manage async tasks and also do more explicit parallel threading yourself. It all depends on how much control you want and your objectives. I suggest looking at the link I posted to see some of the available options.

This is a good overview to the async/await in C#:

http://www.dotnetperls.com/async

Re:Perl 6 Is Slower Than My Fat Momma by kafkaesq on Friday April 08, 2016 @09:10PM (#11459370)
Perl 6 may be slow. But I'm not down with the bro-ish title.

If he has issues with women's bodies, HN definitely doesn't need to hear about it.

Re:Perl 6 Is Slower Than My Fat Momma by raiph on Saturday April 09, 2016 @12:22PM (#11461914)
I think this may be one of those situations where the outcome is odious to some even though no individual action was itself odious.

The author of the blog post has said she* wrote the title to mimic the sort of bro-ish thing she was hearing others say about Perl 6. Presumably you can at least see, if you've read the post, how she disagrees with the view expressed in the title?

Second, she did not post it here at HN, bane did. I don't think it's clear she* (bane) was at fault for keeping the original title. Following several recommendations that don't apply afaict, HN's explicit guideline about titles is "please use the original title, unless it is misleading or linkbait".

* I've used "she" as a generic pronoun because I have no idea what the preferred gender identity is of the two folk involved and to add a little spice for thought.

Re:Perl 6 Is Slower Than My Fat Momma by kafkaesq on Saturday April 09, 2016 @04:09PM (#11463063)
My take is if you post something with an obnoxious, click-baity title... then you pretty much need to take responsibility for the gut-level impressions, and general bad, lingering aftertaste that title invokes in people. In particular: you can expect them to read your 1,000-word post to the end, and and attempt to divine what your hidden intentions were in choosing that title.

And my other take is that not every article out there needs to be cross-posted; and putting a gratuitously offensive title at the top is a perfect way of indicating to people that you don't think really merits sharing. If someone is smart enough to tease out the performance nuances of an as insanely overcomplicated engineering contraption as Perl 6... then surely they're smart enough to think of a better article title.

Re:Perl 6 Is Slower Than My Fat Momma by alexc05 on Friday April 08, 2016 @09:30PM (#11459432)
You edited your comment (for the worse in my estimation.)

I was going to agree with you that we don't need to promote crassness on HN.

But regardless of that, his isn't some sort of indication of an underlying misogyny in tech. It's more an indication of a purile, cringey, and awkward attempt at humour.

"Your mamma" jokes have nothing to do with "women's bodies."

That's reductio ad absurdum.

We can keep it classy around HN without buying into the ridiculous gender wars BS that gets thrown around on tumblr and Twitter.

Re:Perl 6 Is Slower Than My Fat Momma by kafkaesq on Friday April 08, 2016 @09:40PM (#11459461)
Your mamma" jokes have nothing to do with "women's bodies."

"Fat momma" jokes have everything to do with men's (often relentlessly juvenile) thoughts about women's bodies, and the need of some males to continually broadcast said thoughts in completely inappropriate contexts. The bottom line is that this is technical forum, and that kind of crap simply doesn't belong here.

Any more than it does on, say, the title of a slide deck at a technical conference.

Re:Perl 6 Is Slower Than My Fat Momma by alexc05 on Friday April 08, 2016 @09:57PM (#11459527)
> The bottom line is that this is technical forum, and that kind of crap simply doesn't belong here.

This, we agree on.

The "men's thoughts" bit returns to the 'reductio' stuff. It's ridiculously under qualified. Consider more 'boys' than men, more opinions on other people's bodies than just women's. Consider both genders make jokes, judgements and, comments at the expense of others' on any number of factors (socio-economic status, hygiene, neck-beardiness, hair colour, musical taste...)

People are mean. This isn't "men v. women" it's just crass, unfunny and, unwelcome.

Re:Perl 6 Is Slower Than My Fat Momma by circuiter on Friday April 08, 2016 @09:20PM (#11459399)
Yes, because only men have mothers right? /s
Re:Perl 6 Is Slower Than My Fat Momma by GFK_of_xmaspast on Friday April 08, 2016 @09:30PM (#11459430)
Click thru and you'll see a picture of a middle-aged white dude.