Skip to content

Commit 34c03c3

Browse files
committed
new performance results
1 parent 9b5ba55 commit 34c03c3

13 files changed

Lines changed: 1178 additions & 515 deletions

File tree

Lines changed: 139 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<style>
22
table {
3-
width: 100% !important;
3+
max-width: 550px;
44
table-layout: auto;
5-
font-size: 0.8em;
65
padding: 2px 2px;
6+
margin-left: 0; /* Aligns table to the left */
7+
margin-right: auto; /* Prevents centering */
78
}
89

910
td, th {
@@ -17,100 +18,168 @@ Benchmark projects are:
1718
- [rust](https://github.com/iShape-Rust/iTriangle/tree/main/performance)
1819
- [cpp](https://github.com/iShape-Rust/cpp_triangle_performance_app)
1920

20-
All tests were run on a machine with the following specifications:
21-
**3 GHz 6-Core Intel Core i5, 40GB 2667 MHz DDR4**
21+
All benchmarks were executed on the following machine:
22+
**3 GHz 6-Core Intel Core i5, 40GB 2667 MHz DDR4**
2223

23-
All results are presented in seconds.
24+
All results are presented in microseconds (10⁻⁶ sec).
2425

25-
## Solvers:
26+
Each test was repeated multiple times, and the average result is shown.
2627

27-
- **iTriangle(Unchecked-Raw)** v0.32.0 _– only raw triangulation, no validation check_
28-
- **iTriangle(Unchecked-Delaunay)** v0.32.0 _– raw triangulation and refinement Delaunay_
29-
- **iTriangle(Raw)** v0.32.0 _– validation and raw triangulation_
30-
- **iTriangle(Delaunay)** v0.32.0 _– validation, raw triangulation and refinement Delaunay_
31-
- **earcutr(MapBox)** v0.4.3 – Rust [port](https://crates.io/crates/earcutr)_– only raw triangulation, no validation check_
32-
- **earcut(MapBox)** v2.2.4 – C++ [official](https://github.com/mapbox/earcut.hpp)_– only raw triangulation, no validation check_
33-
- **triangle** v1.6 – C [official](https://www.cs.cmu.edu/~quake/triangle.html)_– constraint Delaunay triangulation, no validation check_
28+
All input shapes are clean (non-self-intersecting), and the logic was optimized to achieve maximum performance.
3429

30+
## Solvers
3531

36-
## Simple Star Test
32+
- **iTriangle (Earcut64, Rust)** v0.36.1 — raw triangulation, no holes, limited to ≤64 points, validation disabled
33+
- **iTriangle (Monotone, Rust)** v0.36.1 — raw triangulation, validation disabled
34+
- **iTriangle (Delaunay, Rust)** v0.36.1 — Delaunay triangulation, validation disabled
35+
- **MapBox (Earcut Rust)** v0.5.0 – Rust [port](https://crates.io/crates/earcutr) – raw triangulation, validation disabled
36+
- **MapBox (Earcut C++)** v2.2.4 – C++ [official](https://github.com/mapbox/earcut.hpp) – raw triangulation, validation disabled
37+
- **Triangle (Delaunay C)** v1.6 – C [official](https://www.cs.cmu.edu/~quake/triangle.html) - constrained Delaunay triangulation, validation disabled
3738

38-
This test generates and triangulate 10,000 unique star-shaped polygons, one at a time.
39-
Each shape is defined by:
40-
41-
- A unique radius scale (100 variations)
42-
- A unique rotation (100 steps across a full circle)
43-
- A given number of corners (count), each with 10 points
44-
45-
_All shapes are clean (non-intersecting), and no mesh is reused — each one is processed independently._
39+
## Star Test
4640

4741
<p align="center">
4842
<img src="test_0.svg" width="200"/>
4943
</p>
5044

51-
|Count|Un-Raw |Un-Delaunay |Raw |Delaunay |Earcutr (Rust)|Earcut (C++)|Triangle (C)|
52-
|-----|------------|------------|------------|------------|--------------|------------|------------|
53-
|4 |0.042724 |0.111433 |0.079023 |0.149286 |0.057268 |0.02506 |0.46007 |
54-
|8 |0.083704 |0.217058 |0.169321 |0.303273 |0.127877 |0.06689 |0.88458 |
55-
|16 |0.174608 |0.403747 |0.373843 |0.616759 |0.290149 |0.21948 |1.52763 |
56-
|32 |0.363115 |0.773319 |0.832105 |1.253739 |0.693053 |0.49421 |3.07119 |
57-
|64 |0.769955 |1.490260 |2.077839 |2.849603 |1.699206 |1.2837 |6.14373 |
58-
|128 |1.688746 |2.911652 |5.533498 |6.883017 |4.253521 |3.15526 |11.7701 |
59-
|256 |3.465031 |5.761777 |16.05451 |18.57409 |11.46082 |8.58501 |23.1163 |
60-
|512 |7.063979 |11.47869 |45.20263 |49.50912 |40.62317 |32.9052 |45.0489 |
6145

62-
## Star with Hole Test
46+
### Raw
47+
48+
|Count |Earcut64 |Monotone |Earcut Rust |Earcut C++ |
49+
|------|--------------|--------------|---------------|------------|
50+
|8 |0.28 |0.5 |0.73 |0.42 |
51+
|16 |0.6 |1.6 |1.23 |0.5 |
52+
|32 |1.54 |3.9 |2.6 |1.2 |
53+
|64 |4.46 |8.35 |5.6 |3.3 |
54+
|128 |- |17.8 |12.6 |8.4 |
55+
|256 |- |37.5 |29.1 |22.9 |
56+
|512 |- |79.7 |80.7 |72.7 |
57+
|1024 |- |172 |259 |209 |
58+
|2048 |- |388 |736 |641 |
59+
|4096 |- |898 |3158 |2804 |
60+
|8192 |- |1824 |13435 |11479 |
61+
|16384 |- |3846 |51688 |44017 |
62+
63+
### Delaunay
64+
65+
|Count |iTriangle |Triangle |
66+
|------|--------------|--------------|
67+
|8 |0.46 |4.3 |
68+
|16 |1.0 |8.3 |
69+
|32 |2.5 |25 |
70+
|64 |6.65 |130 |
71+
|128 |19.7 |271 |
72+
|256 |40.5 |523 |
73+
|512 |85.9 |1006 |
74+
|1024 |194 |1704 |
75+
|2048 |424 |2828 |
76+
|4096 |987 |4806 |
77+
|8192 |2074 |8581 |
78+
|16384 |4533 |16384 |
79+
80+
## Spiral Test
81+
82+
<p align="center">
83+
<img src="test_1.svg" width="200"/>
84+
</p>
6385

64-
This test generates and triangulates 10,000 unique star-shaped polygons with a central hole, one at a time.
65-
Each shape is defined by:
6686

67-
- A unique radius scale (100 variations)
68-
- A unique rotation (100 steps across a full circle)
69-
- A central hole generated as a smaller star
70-
- A given number of corners (count), each with 10 points
87+
### Raw
88+
89+
|Count |Earcut64 |Monotone |Earcut Rust |Earcut C++ |
90+
|------|--------------|--------------|---------------|------------|
91+
|8 |0.33 |0.7 |0.79 |0.42 |
92+
|16 |1.13 |1.4 |1.71 |0.77 |
93+
|32 |4.22 |3.0 |6.44 |3.4 |
94+
|64 |19.1 |6.2 |18.6 |19.8 |
95+
|128 |- |12.8 |71.6 |66 |
96+
|256 |- |26.7 |295 |306 |
97+
|512 |- |55.5 |1230 |1438 |
98+
|1024 |- |120 |5301 |7595 |
99+
|2048 |- |279 |22682 |50140 |
100+
|4096 |- |685 |96933 |376060 |
101+
|8192 |- |1435 |416943 |3.7kk |
102+
|16384 |- |3080 |1812147 |43.4kk |
103+
104+
### Delaunay
105+
106+
|Count |iTriangle |Triangle |
107+
|------|--------------|--------------|
108+
|8 |0.51 |3.2 |
109+
|16 |1.6 |8.7 |
110+
|32 |5.0 |21.5 |
111+
|64 |19.9 |35.6 |
112+
|128 |14.6 |66.9 |
113+
|256 |29.7 |166 |
114+
|512 |62.2 |340 |
115+
|1024 |139 |728 |
116+
|2048 |313 |1469 |
117+
|4096 |735 |82948 |
118+
|8192 |1442 |6609 |
119+
|16384 |3463 |13863 |
71120

72-
_All shapes are clean (non-intersecting), and no mesh is reused — each one is processed independently._
121+
122+
## Star with Hole Test
73123

74124
<p align="center">
75-
<img src="test_1.svg" width="200"/>
125+
<img src="test_2.svg" width="200"/>
76126
</p>
77127

78-
| Count | Un-Raw | Un-Delaunay | Raw | Delaunay |Earcutr (Rust)| Earcut (C++)| Triangle (C)|
79-
|-------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|
80-
| 4 | 0.094518 | 0.201821 | 0.250895 | 0.361006 | 0.187054 | 0.136161 | 0.80138 |
81-
| 8 | 0.187340 | 0.380116 | 0.533652 | 0.743455 | 0.492114 | 0.454629 | 1.59074 |
82-
| 16 | 0.388725 | 0.728224 | 1.200238 | 1.579734 | 1.537897 | 1.52663 | 3.12989 |
83-
| 32 | 0.796857 | 1.477642 | 3.011562 | 3.662901 | 6.108676 | 5.16188 | 6.21763 |
84-
| 64 | 1.686455 | 2.747037 | 7.879640 | 9.071579 | 29.41532 | 25.1207 | 12.29 |
85-
| 128 | 3.601513 | 5.478580 | 22.38637 | 24.40913 | 201.3632 | 161.923 | 24.6715 |
86-
| 256 | 7.615879 | 11.41139 | 63.66546 | 67.22043 | --- | --- | 50.5745 |
87128

129+
### Raw
88130

89-
## Rect with Star Holes Test
131+
|Count |Monotone |Earcut Rust |Earcut C++ |
132+
|------|--------------|---------------|------------|
133+
|128 |12.1 |31.9 |30.2 |
134+
|256 |22.4 |86.6 |78.8 |
135+
|512 |42.3 |227 |222 |
136+
|1024 |84.4 |650 |593 |
137+
|2048 |174 |2053 |1825 |
138+
|4096 |333 |7102 |5702 |
139+
|8192 |755 |26197 |22390 |
140+
|16384 |1636 |102874 |80154 |
90141

91-
This test generates and triangulates 25 unique rectangles filled with many 5 corners star-shaped holes.
142+
### Delaunay
92143

93-
Each shape is defined by:
144+
|Count |iTriangle |Triangle |
145+
|------|--------------|--------------|
146+
|128 |16.8 |201 |
147+
|256 |32.8 |410 |
148+
|512 |61.6 |808 |
149+
|1024 |121 |1616 |
150+
|2048 |250 |3055 |
151+
|4096 |505 |6410 |
152+
|8192 |1401 |12919 |
153+
|16384 |4093 |30704 |
94154

95-
- A large outer rectangle
96-
- A grid of count × count small stars as holes, each with:
97-
- A varying radius scale (5 variations)
98-
- A unique rotation (5 variations)
99-
- 5 corners per star, with 10 points per corner.
100-
101-
_All shapes are clean (non-intersecting), and no mesh is reused — each one is processed independently._
155+
## Star with 8 holes Test
102156

103157
<p align="center">
104-
<img src="test_2.svg" width="200"/>
158+
<img src="test_3.svg" width="200"/>
105159
</p>
106160

107-
|Count| Un-Raw | Un-Delaunay | Raw | Delaunay |Earcutr (Rust)| Earcut (C++)| Triangle (C)|
108-
|-----|-------------|--------------|-------------|--------------|--------------|-------------|-------------|
109-
|4 | 0.002339 | 0.008275 | 0.009139 | 0.042705 | 0.037897 | 0.005311 | 0.02818 |
110-
|8 | 0.008906 | 0.024921 | 0.036900 | 0.104350 | 0.076405 | 0.043103 | 0.09457 |
111-
|16 | 0.044372 | 0.116687 | 0.142827 | 0.323554 | 0.605979 | 0.571262 | 0.32930 |
112-
|32 | 0.186836 | 0.510489 | 0.460254 | 0.936904 | 7.496754 | 8.54836 | 1.34492 |
113-
|64 | 0.786142 | 2.617753 | 1.985195 | 4.231544 | 210.3838 | 201.28 | 5.86257 |
114-
|128 | 4.351395 | 18.80902 | 9.719830 | 24.87851 | --- | --- | 28.4693 |
115-
|256 | 18.93581 | 149.7484 | 37.08732 | 179.9286 | --- | --- | 175.662 |
161+
162+
### Raw
163+
164+
|Count |Monotone |Earcut Rust |Earcut C++ |
165+
|------|--------------|---------------|------------|
166+
|256 |19.3 |117 |43 |
167+
|512 |30.3 |260 |107 |
168+
|1024 |53.7 |437 |270 |
169+
|2048 |107 |5018 |576 |
170+
|4096 |200 |40596 |1517 |
171+
|8192 |388 |156287 |3802 |
172+
|16384 |797 |273567 |12687 |
173+
174+
### Delaunay
175+
176+
|Count |iTriangle |Triangle |
177+
|------|--------------|--------------|
178+
|256 |23.7 |330 |
179+
|512 |41.6 |546 |
180+
|1024 |71.4 |951 |
181+
|2048 |143 |1777 |
182+
|4096 |276 |3398 |
183+
|8192 |567 |6921 |
184+
|16384 |1539 |13748 |
116185

docs-gen/src/triangle/performance/test_0.svg

Lines changed: 38 additions & 50 deletions
Loading

0 commit comments

Comments
 (0)