This page is no longer maintained — Please continue to the home page at www.scala-lang.org

performance question

24 replies
H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.

which of the collections has the fastest foreach?

Tony Morris 2
Joined: 2009-03-20,
User offline. Last seen 42 years 45 weeks ago.
Re: performance question

scala.Unit

HamsterofDeath wrote:
> which of the collections has the fastest foreach?
>
>

Kevin Wright 2
Joined: 2010-05-30,
User offline. Last seen 26 weeks 4 days ago.
Re: performance question
:)

On 14 August 2010 12:11, Tony Morris <tonymorris@gmail.com> wrote:
scala.Unit

HamsterofDeath wrote:
>  which of the collections has the fastest foreach?
>
>

--
Tony Morris
http://tmorris.net/





--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: performance question

i cannot deduce what you intended with that response

Am 14.08.2010 13:11, schrieb Tony Morris:
> scala.Unit
>
> HamsterofDeath wrote:
>> which of the collections has the fastest foreach?
>>
>>

Kevin Wright 2
Joined: 2010-05-30,
User offline. Last seen 26 weeks 4 days ago.
Re: performance question
Unit doesn't actually have a forEach method, so your next best bet is probably Option - should be pretty speedy :)

On 14 August 2010 12:27, HamsterofDeath <h-star@gmx.de> wrote:
 i cannot deduce what you intended with that response

Am 14.08.2010 13:11, schrieb Tony Morris:
> scala.Unit
>
> HamsterofDeath wrote:
>>  which of the collections has the fastest foreach?
>>
>>




--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda

Andrew Milkowski
Joined: 2010-07-26,
User offline. Last seen 42 years 45 weeks ago.
Re: performance question
It would be really funny if Unit had the forEach method returning Unit:)

Sent from my Verizon Wireless BlackBerry

From: Kevin Wright <kev.lee.wright@gmail.com> Date: Sat, 14 Aug 2010 12:31:42 +0100To: HamsterofDeath<h-star@gmx.de>Cc: Tony Morris<tonymorris@gmail.com>; scala-user@listes.epfl.ch<scala-user@listes.epfl.ch>Subject: Re: [scala-user] performance question
Unit doesn't actually have a forEach method, so your next best bet is probably Option - should be pretty speedy :)

On 14 August 2010 12:27, HamsterofDeath <h-star@gmx.de> wrote:
 i cannot deduce what you intended with that response

Am 14.08.2010 13:11, schrieb Tony Morris:
> scala.Unit
>
> HamsterofDeath wrote:
>>  which of the collections has the fastest foreach?
>>
>>




--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda

Tony Morris 2
Joined: 2009-03-20,
User offline. Last seen 42 years 45 weeks ago.
Re: performance question

It does in both Scalaz and Haskell but it has a different name.

scala> trait Semigroup[A] { def append(a1: A, a2: A): A }; class
UnitSemigroup extends Semigroup[Unit] { def append(a1: Unit, a2: Unit) =
() }

>> () `mappend` ()
()

I'm not sure what is so confusing about the response. It's a direct
answer to the question at hand.

Andrew Milkowski wrote:
> It would be really funny if Unit had the forEach method returning Unit:)
>
> Sent from my Verizon Wireless BlackBerry
>
> ------------------------------------------------------------------------
> *From: * Kevin Wright
> *Date: *Sat, 14 Aug 2010 12:31:42 +0100
> *To: *HamsterofDeath
> *Cc: *Tony Morris;
> scala-user@listes.epfl.ch
> *Subject: *Re: [scala-user] performance question
>
> Unit doesn't actually have a forEach method, so your next best bet is
> probably Option - should be pretty speedy :)
>
> On 14 August 2010 12:27, HamsterofDeath > wrote:
>
> i cannot deduce what you intended with that response
>
> Am 14.08.2010 13:11, schrieb Tony Morris:
> > scala.Unit
> >
> > HamsterofDeath wrote:
> >> which of the collections has the fastest foreach?
> >>
> >>
>
>
>
>

Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: performance question


On Sat, Aug 14, 2010 at 1:40 PM, Andrew Milkowski <andrewmilkowski@gmail.com> wrote:
It would be really funny if Unit had the forEach method returning Unit:)

object Unit {
  def foreach(f: (Unit) => Unit): Unit = f(this)
}
 
Side-effect heaven.

Sent from my Verizon Wireless BlackBerry

From: Kevin Wright <kev.lee.wright@gmail.com> Date: Sat, 14 Aug 2010 12:31:42 +0100To: HamsterofDeath<h-star@gmx.de>Cc: Tony Morris<tonymorris@gmail.com>; scala-user@listes.epfl.ch<scala-user@listes.epfl.ch> Subject: Re: [scala-user] performance question
Unit doesn't actually have a forEach method, so your next best bet is probably Option - should be pretty speedy :)

On 14 August 2010 12:27, HamsterofDeath <h-star@gmx.de> wrote:
 i cannot deduce what you intended with that response

Am 14.08.2010 13:11, schrieb Tony Morris:
> scala.Unit
>
> HamsterofDeath wrote:
>>  which of the collections has the fastest foreach?
>>
>>




--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda




--
Viktor Klang,
Code Connoisseur
Work:   www.akkasource.com
Code:   github.com/viktorklang
Follow: twitter.com/viktorklang
Read:   klangism.tumblr.com

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: performance question
ok, let me ask it this way:
array, list or hashset?

Am 14.08.2010 13:31, schrieb Kevin Wright:
_6kgXpLTDqunPY66N+aFTyyJwDCcnjecBz+5g [at] mail [dot] gmail [dot] com" type="cite">Unit doesn't actually have a forEach method, so your next best bet is probably Option - should be pretty speedy :)

On 14 August 2010 12:27, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
 i cannot deduce what you intended with that response

Am 14.08.2010 13:11, schrieb Tony Morris:
> scala.Unit
>
> HamsterofDeath wrote:
>>  which of the collections has the fastest foreach?
>>
>>




--
Kevin Wright

mail/google talk: kev [dot] lee [dot] wright [at] gmail [dot] com" rel="nofollow">kev.lee.wright@gmail.com
wave: kev [dot] lee [dot] wright [at] googlewave [dot] com" rel="nofollow">kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda


Kevin Wright 2
Joined: 2010-05-30,
User offline. Last seen 26 weeks 4 days ago.
Re: performance question
Or Buffer, or Vector, or LinearSeq...
My guess would be Array (at least until the 2.9 parallel collections come out), but if you have a genuine need to micro-optimise at this level - use a profiler.

On 14 August 2010 13:26, HamsterofDeath <h-star@gmx.de> wrote:
ok, let me ask it this way:
array, list or hashset?

Am 14.08.2010 13:31, schrieb Kevin Wright:
Unit doesn't actually have a forEach method, so your next best bet is probably Option - should be pretty speedy :)

On 14 August 2010 12:27, HamsterofDeath <h-star@gmx.de> wrote:
 i cannot deduce what you intended with that response

Am 14.08.2010 13:11, schrieb Tony Morris:
> scala.Unit
>
> HamsterofDeath wrote:
>>  which of the collections has the fastest foreach?
>>
>>




--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda





--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: performance question
the profilter told me that i should either use a faster foreach, or solve the problem in a different way, and i was wondering if swiching the collection type could give me a speed boost

Am 14.08.2010 15:34, schrieb Kevin Wright:
aqb66wPBnysWWcEhtTS2K0ON4cwCXwBf5RR8w [at] mail [dot] gmail [dot] com" type="cite">Or Buffer, or Vector, or LinearSeq...
My guess would be Array (at least until the 2.9 parallel collections come out), but if you have a genuine need to micro-optimise at this level - use a profiler.

On 14 August 2010 13:26, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de> wrote:
ok, let me ask it this way:
array, list or hashset?

Am 14.08.2010 13:31, schrieb Kevin Wright:
Unit doesn't actually have a forEach method, so your next best bet is probably Option - should be pretty speedy :)

On 14 August 2010 12:27, HamsterofDeath <h-star [at] gmx [dot] de" target="_blank" rel="nofollow">h-star@gmx.de> wrote:
 i cannot deduce what you intended with that response

Am 14.08.2010 13:11, schrieb Tony Morris:
> scala.Unit
>
> HamsterofDeath wrote:
>>  which of the collections has the fastest foreach?
>>
>>




--
Kevin Wright

mail/google talk: kev [dot] lee [dot] wright [at] gmail [dot] com" target="_blank" rel="nofollow">kev.lee.wright@gmail.com
wave: kev [dot] lee [dot] wright [at] googlewave [dot] com" target="_blank" rel="nofollow">kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda





--
Kevin Wright

mail/google talk: kev [dot] lee [dot] wright [at] gmail [dot] com" rel="nofollow">kev.lee.wright@gmail.com
wave: kev [dot] lee [dot] wright [at] googlewave [dot] com" rel="nofollow">kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda


David Flemström
Joined: 2009-08-10,
User offline. Last seen 42 years 45 weeks ago.
Re: performance question
On Sat, Aug 14, 2010 at 4:44 PM, HamsterofDeath <h-star@gmx.de> wrote:
the profilter told me that i should either use a faster foreach, or solve the problem in a different way, and i was wondering if swiching the collection type could give me a speed boost
 Using anything that extends IndexedSeq, and a "val len = seq.length; var i = 0; while(i < len) { doStuff(seq(i)); i += 1 }" will be the fastest thing you can get until parallel collections arrive.
ichoran
Joined: 2009-08-14,
User offline. Last seen 2 years 3 weeks ago.
Re: performance question
While loops with arrays are fastest.  I haven't specifically tested all of the other collections, but WrappedArray and other things backed by a single array are going to be the fastest things in the collections hierarchy.  Unfortunately, the immutable collections are slower because either they do pointer-chasing (lists) or have multiple levels (vector).

Also, make sure it's not boxing/unboxing which is the problem.  The biggest penalties I've run into are usually when using primitives that need to be boxed.  In contrast to that, the overhead of the foreach loop is usually minimal.

  --Rex

On Sat, Aug 14, 2010 at 10:44 AM, HamsterofDeath <h-star@gmx.de> wrote:
the profilter told me that i should either use a faster foreach, or solve the problem in a different way, and i was wondering if swiching the collection type could give me a speed boost

Am 14.08.2010 15:34, schrieb Kevin Wright:
Or Buffer, or Vector, or LinearSeq...
My guess would be Array (at least until the 2.9 parallel collections come out), but if you have a genuine need to micro-optimise at this level - use a profiler.

On 14 August 2010 13:26, HamsterofDeath <h-star@gmx.de> wrote:
ok, let me ask it this way:
array, list or hashset?

Am 14.08.2010 13:31, schrieb Kevin Wright:
Unit doesn't actually have a forEach method, so your next best bet is probably Option - should be pretty speedy :)

On 14 August 2010 12:27, HamsterofDeath <h-star@gmx.de> wrote:
 i cannot deduce what you intended with that response

Am 14.08.2010 13:11, schrieb Tony Morris:
> scala.Unit
>
> HamsterofDeath wrote:
>>  which of the collections has the fastest foreach?
>>
>>




--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda





--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda



Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
Re: performance question

Have you tried compiling with -optimise?  If you're lucky.  It will inline your iteration, or at least at one time this was true.   In any case, that can give the JIT a head start.

On Aug 14, 2010 10:44 AM, "HamsterofDeath" <h-star@gmx.de> wrote:

the profilter told me that i should either use a faster foreach, or solve the problem in a different way, and i was wondering if swiching the collection type could give me a speed boost

Am 14.08.2010 15:34, schrieb Kevin Wright:


>
> Or Buffer, or Vector, or LinearSeq...
>
> My guess would be Array (at least until the 2.9 paral...

Elazar Leibovich
Joined: 2009-10-07,
User offline. Last seen 42 years 45 weeks ago.
Re: performance question
On Sat, Aug 14, 2010 at 1:55 PM, Tony Morris <tonymorris@gmail.com> wrote:

I'm not sure what is so confusing about the response. It's a direct
answer to the question at hand.

- Do you know how can I get to the nearest gas station?- Yes, I do know that.
(that is, what was confusing about your response, is, that you were expected to deduce the OP was not looking for this answer, just like the above conversation. Person B answered technically person's A's questions. But everyone understands that person A was really asking where is the nearest gas station. Since obviously person A can't do much with the fact that person B knows where the nearest gas station is).
Tako Schotanus
Joined: 2008-12-22,
User offline. Last seen 42 years 45 weeks ago.
Re: performance question
Oh goody car comparisons, seems we're on /. instead of the scala mailing list :)

But anyway, this is not like asking for the nearest gas station, because that would be unambiguous question.
The same can be said for the OP's question, it's just not clear what he wants, it's like asking "what's the best car?".
Best in what way? There's an almost infinite amount of possible correct answers.

Thing is I guess is that nobody fell like pointing out to him that he was giving way too little information to be able to expect an answer.
(and writing a one-liner almost demanding an answer doesn't help either I guess)

-Tako


On Mon, Aug 16, 2010 at 08:35, Elazar Leibovich <elazarl@gmail.com> wrote:
On Sat, Aug 14, 2010 at 1:55 PM, Tony Morris <tonymorris@gmail.com> wrote:

I'm not sure what is so confusing about the response. It's a direct
answer to the question at hand.

- Do you know how can I get to the nearest gas station?- Yes, I do know that.
(that is, what was confusing about your response, is, that you were expected to deduce the OP was not looking for this answer, just like the above conversation. Person B answered technically person's A's questions. But everyone understands that person A was really asking where is the nearest gas station. Since obviously person A can't do much with the fact that person B knows where the nearest gas station is).

Naftoli Gugenheim
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: performance question
You mean it's like asking what's the fastest car?

On Mon, Aug 16, 2010 at 3:51 AM, Tako Schotanus <scala@codejive.org> wrote:
Oh goody car comparisons, seems we're on /. instead of the scala mailing list :)

But anyway, this is not like asking for the nearest gas station, because that would be unambiguous question.
The same can be said for the OP's question, it's just not clear what he wants, it's like asking "what's the best car?".
Best in what way? There's an almost infinite amount of possible correct answers.

Thing is I guess is that nobody fell like pointing out to him that he was giving way too little information to be able to expect an answer.
(and writing a one-liner almost demanding an answer doesn't help either I guess)

-Tako


On Mon, Aug 16, 2010 at 08:35, Elazar Leibovich <elazarl@gmail.com> wrote:
On Sat, Aug 14, 2010 at 1:55 PM, Tony Morris <tonymorris@gmail.com> wrote:

I'm not sure what is so confusing about the response. It's a direct
answer to the question at hand.

- Do you know how can I get to the nearest gas station?- Yes, I do know that.
(that is, what was confusing about your response, is, that you were expected to deduce the OP was not looking for this answer, just like the above conversation. Person B answered technically person's A's questions. But everyone understands that person A was really asking where is the nearest gas station. Since obviously person A can't do much with the fact that person B knows where the nearest gas station is).


Kevin Wright 2
Joined: 2010-05-30,
User offline. Last seen 26 weeks 4 days ago.
Re: performance question
More like asking what's the fastest vehicle, but without specifying the cargo or how far it has to travel.

On 17 August 2010 20:58, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
You mean it's like asking what's the fastest car?

On Mon, Aug 16, 2010 at 3:51 AM, Tako Schotanus <scala@codejive.org> wrote:
Oh goody car comparisons, seems we're on /. instead of the scala mailing list :)

But anyway, this is not like asking for the nearest gas station, because that would be unambiguous question.
The same can be said for the OP's question, it's just not clear what he wants, it's like asking "what's the best car?".
Best in what way? There's an almost infinite amount of possible correct answers.

Thing is I guess is that nobody fell like pointing out to him that he was giving way too little information to be able to expect an answer.
(and writing a one-liner almost demanding an answer doesn't help either I guess)

-Tako


On Mon, Aug 16, 2010 at 08:35, Elazar Leibovich <elazarl@gmail.com> wrote:
On Sat, Aug 14, 2010 at 1:55 PM, Tony Morris <tonymorris@gmail.com> wrote:

I'm not sure what is so confusing about the response. It's a direct
answer to the question at hand.

- Do you know how can I get to the nearest gas station?- Yes, I do know that.
(that is, what was confusing about your response, is, that you were expected to deduce the OP was not looking for this answer, just like the above conversation. Person B answered technically person's A's questions. But everyone understands that person A was really asking where is the nearest gas station. Since obviously person A can't do much with the fact that person B knows where the nearest gas station is).





--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda

Andrew Milkowski
Joined: 2010-07-26,
User offline. Last seen 42 years 45 weeks ago.
Re: performance question
But supplying color of the vehicle:) (couldn't help:)

Sent from my Verizon Wireless BlackBerry

From: Kevin Wright <kev.lee.wright@gmail.com> Date: Tue, 17 Aug 2010 22:35:18 +0100To: Naftoli Gugenheim<naftoligug@gmail.com>Cc: Tako Schotanus<scala@codejive.org>; scala-user@listes.epfl.ch<scala-user@listes.epfl.ch>Subject: Re: [scala-user] performance question
More like asking what's the fastest vehicle, but without specifying the cargo or how far it has to travel.

On 17 August 2010 20:58, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
You mean it's like asking what's the fastest car?

On Mon, Aug 16, 2010 at 3:51 AM, Tako Schotanus <scala@codejive.org> wrote:
Oh goody car comparisons, seems we're on /. instead of the scala mailing list :)

But anyway, this is not like asking for the nearest gas station, because that would be unambiguous question.
The same can be said for the OP's question, it's just not clear what he wants, it's like asking "what's the best car?".
Best in what way? There's an almost infinite amount of possible correct answers.

Thing is I guess is that nobody fell like pointing out to him that he was giving way too little information to be able to expect an answer.
(and writing a one-liner almost demanding an answer doesn't help either I guess)

-Tako


On Mon, Aug 16, 2010 at 08:35, Elazar Leibovich <elazarl@gmail.com> wrote:
On Sat, Aug 14, 2010 at 1:55 PM, Tony Morris <tonymorris@gmail.com> wrote:

I'm not sure what is so confusing about the response. It's a direct
answer to the question at hand.

- Do you know how can I get to the nearest gas station?- Yes, I do know that.
(that is, what was confusing about your response, is, that you were expected to deduce the OP was not looking for this answer, just like the above conversation. Person B answered technically person's A's questions. But everyone understands that person A was really asking where is the nearest gas station. Since obviously person A can't do much with the fact that person B knows where the nearest gas station is).





--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda

Naftoli Gugenheim
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: performance question
What would be the extra factors to consider in this case?

On Tue, Aug 17, 2010 at 5:35 PM, Kevin Wright <kev.lee.wright@gmail.com> wrote:
More like asking what's the fastest vehicle, but without specifying the cargo or how far it has to travel.

On 17 August 2010 20:58, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
You mean it's like asking what's the fastest car?

On Mon, Aug 16, 2010 at 3:51 AM, Tako Schotanus <scala@codejive.org> wrote:
Oh goody car comparisons, seems we're on /. instead of the scala mailing list :)

But anyway, this is not like asking for the nearest gas station, because that would be unambiguous question.
The same can be said for the OP's question, it's just not clear what he wants, it's like asking "what's the best car?".
Best in what way? There's an almost infinite amount of possible correct answers.

Thing is I guess is that nobody fell like pointing out to him that he was giving way too little information to be able to expect an answer.
(and writing a one-liner almost demanding an answer doesn't help either I guess)

-Tako


On Mon, Aug 16, 2010 at 08:35, Elazar Leibovich <elazarl@gmail.com> wrote:
On Sat, Aug 14, 2010 at 1:55 PM, Tony Morris <tonymorris@gmail.com> wrote:

I'm not sure what is so confusing about the response. It's a direct
answer to the question at hand.

- Do you know how can I get to the nearest gas station?- Yes, I do know that.
(that is, what was confusing about your response, is, that you were expected to deduce the OP was not looking for this answer, just like the above conversation. Person B answered technically person's A's questions. But everyone understands that person A was really asking where is the nearest gas station. Since obviously person A can't do much with the fact that person B knows where the nearest gas station is).





--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda


Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: performance question


On Tue, Aug 17, 2010 at 11:47 PM, Andrew Milkowski <andrewmilkowski@gmail.com> wrote:
But supplying color of the vehicle:) (couldn't help:)

"Orkish psychic abilities filling in whatever gaps in engineering may be present, an effect the Orks themselves are generally unaware of, present most notably in the fact that "The red ones go faster", meaning that any vehicle, painted red, will move faster than other vehicles for no other reason than the Orks believe it to be so." - Wikipedia 

Sent from my Verizon Wireless BlackBerry

From: Kevin Wright <kev.lee.wright@gmail.com> Date: Tue, 17 Aug 2010 22:35:18 +0100To: Naftoli Gugenheim<naftoligug@gmail.com>Cc: Tako Schotanus<scala@codejive.org>; scala-user@listes.epfl.ch<scala-user@listes.epfl.ch> Subject: Re: [scala-user] performance question
More like asking what's the fastest vehicle, but without specifying the cargo or how far it has to travel.

On 17 August 2010 20:58, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
You mean it's like asking what's the fastest car?

On Mon, Aug 16, 2010 at 3:51 AM, Tako Schotanus <scala@codejive.org> wrote:
Oh goody car comparisons, seems we're on /. instead of the scala mailing list :)

But anyway, this is not like asking for the nearest gas station, because that would be unambiguous question.
The same can be said for the OP's question, it's just not clear what he wants, it's like asking "what's the best car?".
Best in what way? There's an almost infinite amount of possible correct answers.

Thing is I guess is that nobody fell like pointing out to him that he was giving way too little information to be able to expect an answer.
(and writing a one-liner almost demanding an answer doesn't help either I guess)

-Tako


On Mon, Aug 16, 2010 at 08:35, Elazar Leibovich <elazarl@gmail.com> wrote:
On Sat, Aug 14, 2010 at 1:55 PM, Tony Morris <tonymorris@gmail.com> wrote:

I'm not sure what is so confusing about the response. It's a direct
answer to the question at hand.

- Do you know how can I get to the nearest gas station?- Yes, I do know that.
(that is, what was confusing about your response, is, that you were expected to deduce the OP was not looking for this answer, just like the above conversation. Person B answered technically person's A's questions. But everyone understands that person A was really asking where is the nearest gas station. Since obviously person A can't do much with the fact that person B knows where the nearest gas station is).





--
Kevin Wright

mail/google talk: kev.lee.wright@gmail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda




--
Viktor Klang,
Code Connoisseur
Work:   www.akkasource.com
Code:   github.com/viktorklang
Follow: twitter.com/viktorklang
Read:   klangism.tumblr.com

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: performance question

i don't understand what one could have possibly misunderstood when i asked "which collected has the fastest foreach".
the question is so simple that i don't know how to explain it further.

there's a listbuffer, an arraybuffer, a hashset, a whatever, and i call foreach, and i just wanted to know which one, assuming all contain the same elements, need the least time for iterating and calling apply.

-------- Original-Nachricht --------
> Datum: Wed, 18 Aug 2010 08:52:44 +0200
> Von: Viktor Klang
> An: andrewmilkowski@gmail.com
> CC: Kevin Wright , Naftoli Gugenheim , Tako Schotanus , "scala-user@listes.epfl.ch"
> Betreff: Re: [scala-user] performance question

> On Tue, Aug 17, 2010 at 11:47 PM, Andrew Milkowski <
> andrewmilkowski@gmail.com> wrote:
>
> > But supplying color of the vehicle:) (couldn't help:)
>
>
> "Orkish psychic abilities filling in whatever gaps in engineering may be
> present, an effect the Orks themselves are generally unaware of, present
> most notably in the fact that "*The red ones go faster*", meaning that any
> vehicle, painted red, will move faster than other vehicles for no other
> reason than the Orks believe it to be so." -
> Wikipedia
>
>
> > Sent from my Verizon Wireless BlackBerry
> > ------------------------------
> > *From: * Kevin Wright
> > *Date: *Tue, 17 Aug 2010 22:35:18 +0100
> > *To: *Naftoli Gugenheim
> > *Cc: *Tako Schotanus; scala-user@listes.epfl.ch<
> > scala-user@listes.epfl.ch>
> > *Subject: *Re: [scala-user] performance question
> >
> > More like asking what's the fastest vehicle, but without specifying the
> > cargo or how far it has to travel.
> >
> > On 17 August 2010 20:58, Naftoli Gugenheim wrote:
> >
> >> You mean it's like asking what's the fastest car?
> >>
> >>
> >> On Mon, Aug 16, 2010 at 3:51 AM, Tako Schotanus
> wrote:
> >>
> >>> Oh goody car comparisons, seems we're on /. instead of the scala
> mailing
> >>> list :)
> >>>
> >>> But anyway, this is not like asking for the nearest gas station,
> because
> >>> that would be unambiguous question.
> >>> The same can be said for the OP's question, it's just not clear what
> he
> >>> wants, it's like asking "what's the best car?".
> >>> Best in what way? There's an almost infinite amount of possible
> correct
> >>> answers.
> >>>
> >>> Thing is I guess is that nobody fell like pointing out to him that he
> was
> >>> giving way too little information to be able to expect an answer.
> >>> (and writing a one-liner almost demanding an answer doesn't help
> either I
> >>> guess)
> >>>
> >>> -Tako
> >>>
> >>>
> >>>
> >>> On Mon, Aug 16, 2010 at 08:35, Elazar Leibovich
> wrote:
> >>>
> >>>> On Sat, Aug 14, 2010 at 1:55 PM, Tony Morris
> wrote:
> >>>>
> >>>>>
> >>>>> I'm not sure what is so confusing about the response. It's a direct
> >>>>> answer to the question at hand.
> >>>>>
> >>>>
> >>>> - Do you know how can I get to the nearest gas station?
> >>>> - Yes, I do know that.
> >>>>
> >>>> (that is, what was confusing about your response, is, that you were
> >>>> expected to deduce the OP was not looking for this answer, just like
> the
> >>>> above conversation. Person B answered technically person's A's
> questions.
> >>>> But everyone understands that person A was really asking *where* is
> the
> >>>> nearest gas station. Since obviously person A can't do much with the
> fact
> >>>> that person B knows where the nearest gas station is).
> >>>>
> >>>>
> >>>
> >>
> >
> >
> > --
> > Kevin Wright
> >
> > mail/google talk: kev.lee.wright@gmail.com
> > wave: kev.lee.wright@googlewave.com
> > skype: kev.lee.wright
> > twitter: @thecoda
> >
> >
>
>

Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: performance question


On Thu, Aug 19, 2010 at 4:21 PM, Dennis Haupt <h-star@gmx.de> wrote:
i don't understand what one could have possibly misunderstood when i asked "which collected has the fastest foreach".
the question is so simple that i don't know how to explain it further.
 Anything extending this
 

there's a listbuffer, an arraybuffer, a hashset, a whatever, and i call foreach, and i just wanted to know which one, assuming all contain the same elements, need the least time for iterating and calling apply.

-------- Original-Nachricht --------
> Datum: Wed, 18 Aug 2010 08:52:44 +0200
> Von: Viktor Klang <viktor.klang@gmail.com>
> An: andrewmilkowski@gmail.com
> CC: Kevin Wright <kev.lee.wright@gmail.com>, Naftoli Gugenheim <naftoligug@gmail.com>, Tako Schotanus <scala@codejive.org>, "scala-user@listes.epfl.ch" <scala-user@listes.epfl.ch>
> Betreff: Re: [scala-user] performance question

> On Tue, Aug 17, 2010 at 11:47 PM, Andrew Milkowski <
> andrewmilkowski@gmail.com> wrote:
>
> > But supplying color of the vehicle:) (couldn't help:)
>
>
> "Orkish psychic abilities filling in whatever gaps in engineering may be
> present, an effect the Orks themselves are generally unaware of, present
> most notably in the fact that "*The red ones go faster*", meaning that any
> vehicle, painted red, will move faster than other vehicles for no other
> reason than the Orks believe it to be so." -
> Wikipedia<http://en.wikipedia.org/wiki/Ork_%28Warhammer_40,000%29>
>
>
> > Sent from my Verizon Wireless BlackBerry
> > ------------------------------
> > *From: * Kevin Wright <kev.lee.wright@gmail.com>
> > *Date: *Tue, 17 Aug 2010 22:35:18 +0100
> > *To: *Naftoli Gugenheim<naftoligug@gmail.com>
> > *Cc: *Tako Schotanus<scala@codejive.org>; scala-user@listes.epfl.ch<
> > scala-user@listes.epfl.ch>
> > *Subject: *Re: [scala-user] performance question
> >
> > More like asking what's the fastest vehicle, but without specifying the
> > cargo or how far it has to travel.
> >
> > On 17 August 2010 20:58, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
> >
> >> You mean it's like asking what's the fastest car?
> >>
> >>
> >> On Mon, Aug 16, 2010 at 3:51 AM, Tako Schotanus
> <scala@codejive.org>wrote:
> >>
> >>> Oh goody car comparisons, seems we're on /. instead of the scala
> mailing
> >>> list :)
> >>>
> >>> But anyway, this is not like asking for the nearest gas station,
> because
> >>> that would be unambiguous question.
> >>> The same can be said for the OP's question, it's just not clear what
> he
> >>> wants, it's like asking "what's the best car?".
> >>> Best in what way? There's an almost infinite amount of possible
> correct
> >>> answers.
> >>>
> >>> Thing is I guess is that nobody fell like pointing out to him that he
> was
> >>> giving way too little information to be able to expect an answer.
> >>> (and writing a one-liner almost demanding an answer doesn't help
> either I
> >>> guess)
> >>>
> >>> -Tako
> >>>
> >>>
> >>>
> >>> On Mon, Aug 16, 2010 at 08:35, Elazar Leibovich
> <elazarl@gmail.com>wrote:
> >>>
> >>>> On Sat, Aug 14, 2010 at 1:55 PM, Tony Morris
> <tonymorris@gmail.com>wrote:
> >>>>
> >>>>>
> >>>>> I'm not sure what is so confusing about the response. It's a direct
> >>>>> answer to the question at hand.
> >>>>>
> >>>>
> >>>> - Do you know how can I get to the nearest gas station?
> >>>> - Yes, I do know that.
> >>>>
> >>>> (that is, what was confusing about your response, is, that you were
> >>>> expected to deduce the OP was not looking for this answer, just like
> the
> >>>> above conversation. Person B answered technically person's A's
> questions.
> >>>> But everyone understands that person A was really asking *where* is
> the
> >>>> nearest gas station. Since obviously person A can't do much with the
> fact
> >>>> that person B knows where the nearest gas station is).
> >>>>
> >>>>
> >>>
> >>
> >
> >
> > --
> > Kevin Wright
> >
> > mail/google talk: kev.lee.wright@gmail.com
> > wave: kev.lee.wright@googlewave.com
> > skype: kev.lee.wright
> > twitter: @thecoda
> >
> >
>
>
> --
> Viktor Klang,
> Code Connoisseur
> Work:   www.akkasource.com
> Code:   github.com/viktorklang
> Follow: twitter.com/viktorklang
> Read:   klangism.tumblr.com

--
GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 ¿/mtl.!*
http://portal.gmx.net/de/go/dsl



--
Viktor Klang,
Code Connoisseur
Work:   www.akkasource.com
Code:   github.com/viktorklang
Follow: twitter.com/viktorklang
Read:   klangism.tumblr.com

Randall R Schulz
Joined: 2008-12-16,
User offline. Last seen 1 year 29 weeks ago.
Re: performance question

On Thursday August 19 2010, Dennis Haupt wrote:
> i don't understand what one could have possibly misunderstood when i
> asked "which collected has the fastest foreach". the question is so
> simple that i don't know how to explain it further.
>
> there's a listbuffer, an arraybuffer, a hashset, a whatever, and i
> call foreach, and i just wanted to know which one, assuming all
> contain the same elements, need the least time for iterating and
> calling apply.

You shouldn't have done that. I don't think the answer is the same for
the lowest-overhead for iterating and the lostest-cost invocation of
apply(...).

Randall Schulz

Naftoli Gugenheim
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: performance question
Performance Characteristics (from the What's New / Collections API article)

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland