We're updating the issue view to help you get more done. 

Faster PersistentVector, Subvec and ChunkedSeq reduce.

Description

This patch improved the performance of the 2-arity `-reduce` of PersistentVectors as well as the 2 and 3 arity versions of `-reduce` for `Subvecs` and `ChunkedSeqs`.

For large (> 32) `Subvecs` and `ChunkedSeqs` saw a 7x speed up in V8 and up to 11x in JavascriptCore. Smaller versions saw no change.

The 2-arity version of PersistentVector `-reduce` was also improved ~4x and ~7x in V8 and JavascriptCore respectively.

In the benchmarks below all runs where (N <= 32) were run 1,000,000 times. For the larger collections 100,000 iterations were made.

PersistentVector 3-arity reduce (no code was changed)

N

master (v8)

patched (v8)

master (jsc)

patched (jsc)

0

44

44

17

19

1

121

102

29

32

2

151

133

35

37

4

219

199

50

50

8

360

336

79

79

16

606

588

130

131

32

1124

1109

243

250

100

329

338

75

76

1000

3235

3317

704

725

10000

32960

33575

7365

7316

Persistent Vector 2-arity reduce

N

master (v8)

patched (v8)

master (jsc)

patched (jsc)

0

65

41

29

12

1

96

58

49

42

2

147

66

87

45

4

246

85

113

44

8

446

142

202

69

16

829

276

362

98

32

1627

506

693

132

100

534

154

236

41

1000

5442

1568

2321

329

10000

58396

15386

26162

3406

ChunkedSeq 3-arity reduce

N

master (v8)

patched (v8)

master (jsc)

patched (jsc)

0

57

69

93

88

1

54

60

31

26

2

68

63

27

28

4

94

91

37

39

8

146

152

59

58

16

272

266

121

107

32

479

526

170

174

100

1186

165

459

39

1000

11760

1539

4547

334

10000

121986

16080

48639

3384

ChunkedSeq 2-arity reduce

N

master (v8)

patched (v8)

master (jsc)

patched (jsc)

0

62

63

96

97

1

23

31

16

19

2

35

40

20

17

4

68

70

26

29

8

116

120

49

47

16

232

223

83

89

32

467

444

156

158

100

1123

164

417

39

1000

12328

1659

4516

327

10000

126570

15940

47435

3330

Subvec 3-arity reduce

N

master (v8)

patched (v8)

master (jsc)

patched (jsc)

0

67

67

51

34

1

185

71

100

35

2

296

84

160

44

4

514

100

259

52

8

958

156

405

77

16

1878

295

733

138

32

3668

565

1433

139

100

1164

165

462

36

1000

12596

1600

4798

337

10000

122919

16108

48093

3511

Subvec 2-arity reduce

N

master (v8)

patched (v8)

master (jsc)

patched (jsc)

0

73

49

35

22

1

169

58

75

48

2

289

70

117

54

4

544

103

197

56

8

961

159

378

74

16

1852

288

697

103

32

3644

514

1425

145

100

1245

147

441

39

1000

12065

1537

4556

333

10000

122519

15600

46324

3370

The source code for the benchmarks is attached.

Environment

None

Status

Assignee

David Nolen

Reporter

Thomas Mulvaney

Labels

Approval

None

Patch

Code

Priority

Minor