Skip to main content
added 20 characters in body
Source Link
rm -rf
  • 89.3k
  • 21
  • 297
  • 480

I will do

list /. Rule[a_,b_]- :> b

Though less elegant, for large case pattern testlists replacement using patterns seems faster.

list = Table[{x -> RandomReal[], y -> RandomReal[]}, {i, 100000}];
list /. Rule[a_, b_] :> b; // AbsoluteTiming

{0.1530087, Null}

Heike's method

{x, y} /. list; // AbsoluteTiming

{0.3340191, Null}

The very efficient one from kguler

list[[All, All, 2]]; // AbsoluteTiming

{0.0370021, Null}

If I have to choose, {x, y} /. list all the way!

I will do

list/.Rule[a_,b_]-> b

Though less elegant for large case pattern test seems faster.

list = Table[{x -> RandomReal[], y -> RandomReal[]}, {i, 100000}];
list /. Rule[a_, b_] :> b; // AbsoluteTiming

{0.1530087, Null}

Heike's method

{x, y} /. list; // AbsoluteTiming

{0.3340191, Null}

The very efficient one from kguler

list[[All, All, 2]]; // AbsoluteTiming

{0.0370021, Null}

If I have to choose {x, y} /. list all the way!

I will do

list /. Rule[a_,b_] :> b

Though less elegant, for large lists replacement using patterns seems faster.

list = Table[{x -> RandomReal[], y -> RandomReal[]}, {i, 100000}];
list /. Rule[a_, b_] :> b; // AbsoluteTiming

{0.1530087, Null}

Heike's method

{x, y} /. list; // AbsoluteTiming

{0.3340191, Null}

The very efficient one from kguler

list[[All, All, 2]]; // AbsoluteTiming

{0.0370021, Null}

If I have to choose, {x, y} /. list all the way!

edited body
Source Link
PlatoManiac
  • 14.9k
  • 2
  • 43
  • 75

I will do

list/.Rule[a_,b_]-> b

Though less elegant for large case pattern test seems faster.

list = Table[{x -> RandomReal[], y -> RandomReal[]}, {i, 100000}];
list /. Rule[a_, b_] -:> b; // AbsoluteTiming

{0.1530087, Null}

Heike's method

{x, y} /. list; // AbsoluteTiming

{0.3340191, Null}

The very efficient one from kguler

list[[All, All, 2]]; // AbsoluteTiming

{0.0370021, Null}

If I have to choose {x, y} /. list all the way!

I will do

list/.Rule[a_,b_]-> b

Though less elegant for large case pattern test seems faster.

list = Table[{x -> RandomReal[], y -> RandomReal[]}, {i, 100000}];
list /. Rule[a_, b_] -> b; // AbsoluteTiming

{0.1530087, Null}

Heike's method

{x, y} /. list; // AbsoluteTiming

{0.3340191, Null}

The very efficient one from kguler

list[[All, All, 2]]; // AbsoluteTiming

{0.0370021, Null}

If I have to choose {x, y} /. list all the way!

I will do

list/.Rule[a_,b_]-> b

Though less elegant for large case pattern test seems faster.

list = Table[{x -> RandomReal[], y -> RandomReal[]}, {i, 100000}];
list /. Rule[a_, b_] :> b; // AbsoluteTiming

{0.1530087, Null}

Heike's method

{x, y} /. list; // AbsoluteTiming

{0.3340191, Null}

The very efficient one from kguler

list[[All, All, 2]]; // AbsoluteTiming

{0.0370021, Null}

If I have to choose {x, y} /. list all the way!

added 102 characters in body
Source Link
PlatoManiac
  • 14.9k
  • 2
  • 43
  • 75

I will do

list/.Rule[a_,b_]-> b

Though less elegant for large case pattern test seems faster.

list = Table[{x -> RandomReal[], y -> RandomReal[]}, {i, 100000}];
list /. Rule[a_, b_] -> b; // AbsoluteTiming

{0.1530087, Null}

Heike's method

{x, y} /. list; // AbsoluteTiming

{0.3340191, Null}

The very efficient one from kguler

list[[All, All, 2]]; // AbsoluteTiming

{0.0370021, Null}

If I have to choose {x, y} /. list all the way!

I will do

list/.Rule[a_,b_]-> b

Though less elegant for large case pattern test seems faster.

list = Table[{x -> RandomReal[], y -> RandomReal[]}, {i, 100000}];
list /. Rule[a_, b_] -> b; // AbsoluteTiming

{0.1530087, Null}

Heike's method

{x, y} /. list; // AbsoluteTiming

{0.3340191, Null}

If I have to choose {x, y} /. list all the way!

I will do

list/.Rule[a_,b_]-> b

Though less elegant for large case pattern test seems faster.

list = Table[{x -> RandomReal[], y -> RandomReal[]}, {i, 100000}];
list /. Rule[a_, b_] -> b; // AbsoluteTiming

{0.1530087, Null}

Heike's method

{x, y} /. list; // AbsoluteTiming

{0.3340191, Null}

The very efficient one from kguler

list[[All, All, 2]]; // AbsoluteTiming

{0.0370021, Null}

If I have to choose {x, y} /. list all the way!

Post Undeleted by PlatoManiac
Post Deleted by PlatoManiac
added 343 characters in body
Source Link
PlatoManiac
  • 14.9k
  • 2
  • 43
  • 75
Loading
Source Link
PlatoManiac
  • 14.9k
  • 2
  • 43
  • 75
Loading