Skip to content

Fast array partition - #1418

Merged
KevinRansom merged 10 commits into
dotnet:masterfrom
jackmott:fast-array-partition
Aug 12, 2016
Merged

Fast array partition#1418
KevinRansom merged 10 commits into
dotnet:masterfrom
jackmott:fast-array-partition

Conversation

@jackmott

Copy link
Copy Markdown
Contributor

A partition function for arrays that runs about twice as fast and uses about half as much memory. This should be true for all cases, I believe.

Test results using BenchmarkDotNet, with a partition predicate of fun x -> x % 2 = 0 on random int arrays.

Host Process Environment Information:
BenchmarkDotNet=v0.9.8.0
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7-4712HQ CPU 2.30GHz, ProcessorCount=8
Frequency=2240907 ticks, Resolution=446.2479 ns, Timer=TSC
CLR=MS.NET 4.0.30319.42000, Arch=64-bit RELEASE [RyuJIT]
GC=Concurrent Workstation
JitModules=clrjit-v4.6.1590.0
Type=SIMDBenchmark Mode=Throughput Platform=X64 Jit=RyuJit GarbageCollection=Concurrent Workstation 
MethodArrayLengthMedianStdDevScaledGen 0Gen 1Gen 2Bytes Allocated/Op
Partition10180.8758 ns16.3650 ns1.000.01--185.22
NewPartition1076.6145 ns1.2114 ns0.420.01--90.38
Partition100993.5865 ns17.6074 ns1.000.06--773.14
NewPartition100546.2619 ns21.6442 ns0.550.03--422.67
Partition10000117,268.5175 ns1,064.2667 ns1.006.40--99,742.26
NewPartition1000079,020.6291 ns474.4149 ns0.672.64--43,572.00
Partition100000014,447,233.3078 ns205,852.6672 ns1.006.93-79.495,919,035.36
NewPartition10000009,908,404.2756 ns115,392.7494 ns0.69--78.453,587,942.38
Partition10000000154,545,402.8213 ns3,116,253.3692 ns1.00--62.0259,133,643.66
NewPartition1000000098,768,489.7225 ns726,198.4079 ns0.64--34.0029,686,956.03

@msftclas

Copy link
Copy Markdown

Hi @jackmott, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@forki

Copy link
Copy Markdown
Contributor

"A partition function for arrays that runs about twice as fast and uses about half as much memory."

joker

@jackmott

Copy link
Copy Markdown
ContributorAuthor

merging latest master into this and cleaning some things up, stand by.

@jackmott

Copy link
Copy Markdown
ContributorAuthor

All done here unless someone has suggestions.

@KevinRansom

Copy link
Copy Markdown
Contributor

Looks great to me. I will probably pull it later this evening.

@dsyme

Copy link
Copy Markdown
Contributor

Wow. Superb.

@KevinRansom
KevinRansom merged commit af89a30 into dotnet:masterAug 12, 2016
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@jackmott@msftclas@forki@KevinRansom@dsyme