Commit a42108a
committed
⚡️ Slightly faster
The results are highly dependant on data, YJIT, etc... but in my tests
this implementation seems to _consistently_ run faster.
```
Comparison:
builtin: L ^ R
local: 967.0 i/s
before #567 (559b86a): 917.5 i/s - 1.05x slower
before #562 (a228ee1): 901.2 i/s - 1.07x slower
v0.5.12: 840.0 i/s - 1.15x slower
v0.5.0: 830.7 i/s - 1.16x slower
v0.4.21: 797.0 i/s - 1.21x slower
v0.5.9: 790.4 i/s - 1.22x slower
builtin: L.xor! R
local: 960.9 i/s
before #562 (a228ee1): 954.3 i/s - 1.01x slower
before #567 (559b86a): 940.0 i/s - 1.02x slower
v0.5.12: 796.4 i/s - 1.21x slower
v0.5.0: 633.9 i/s - 1.52x slower
v0.4.21: 620.1 i/s - 1.55x slower
v0.5.9: 619.0 i/s - 1.55x slower
```
When I first wrote this code, the `master` branch was consistently
1.3x-1.5x slower. The speedup is much less now, so other implementation
details are probably more important. When the internal set data
implementation is changed (see #484), this and other operations should
be re-evaluated. I suspect an iterative "merge" may be the fastest
overall approach, but that code is more complex than simply relying on
the core add/subtract/complement methods with simple boolean algebra.SequenceSet#xor
1 parent a228ee1 commit a42108a
2 files changed
+12
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| |||
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
72 | | - | |
73 | | - | |
| 78 | + | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1778 | 1778 | | |
1779 | 1779 | | |
1780 | 1780 | | |
1781 | | - | |
1782 | | - | |
1783 | | - | |
1784 | | - | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
1785 | 1785 | | |
1786 | 1786 | | |
1787 | 1787 | | |
| |||
0 commit comments