-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathiteration-benchmark2.html
252 lines (250 loc) · 18.4 KB
/
iteration-benchmark2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<!DOCTYPE html>
<html lang='en' data-theme="dark">
<head>
<meta charset='utf-8' />
<meta name="color-scheme" content="dark light">
<title>Performance Comparison between for, foreach, and ForEeach() method</title>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.7/css/jquery.dataTables.min.css" />
<link rel="stylesheet" href="https://cdn.datatables.net/colreorder/1.5.4/css/colReorder.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.4.2/css/buttons.dataTables.min.css">
<style type="text/css">
:where(html){--ease-1:cubic-bezier(.25,0,.5,1);--ease-2:cubic-bezier(.25,0,.4,1);--ease-3:cubic-bezier(.25,0,.3,1);--ease-4:cubic-bezier(.25,0,.2,1);--ease-5:cubic-bezier(.25,0,.1,1);--ease-in-1:cubic-bezier(.25,0,1,1);--ease-in-2:cubic-bezier(.50,0,1,1);--ease-in-3:cubic-bezier(.70,0,1,1);--ease-in-4:cubic-bezier(.90,0,1,1);--ease-in-5:cubic-bezier(1,0,1,1);--ease-out-1:cubic-bezier(0,0,.75,1);--ease-out-2:cubic-bezier(0,0,.50,1);--ease-out-3:cubic-bezier(0,0,.3,1);--ease-out-4:cubic-bezier(0,0,.1,1);--ease-out-5:cubic-bezier(0,0,0,1);--ease-in-out-1:cubic-bezier(.1,0,.9,1);--ease-in-out-2:cubic-bezier(.3,0,.7,1);--ease-in-out-3:cubic-bezier(.5,0,.5,1);--ease-in-out-4:cubic-bezier(.7,0,.3,1);--ease-in-out-5:cubic-bezier(.9,0,.1,1);--ease-elastic-out-1:cubic-bezier(.5,.75,.75,1.25);--ease-elastic-out-2:cubic-bezier(.5,1,.75,1.25);--ease-elastic-out-3:cubic-bezier(.5,1.25,.75,1.25);--ease-elastic-out-4:cubic-bezier(.5,1.5,.75,1.25);--ease-elastic-out-5:cubic-bezier(.5,1.75,.75,1.25);--ease-elastic-in-1:cubic-bezier(.5,-0.25,.75,1);--ease-elastic-in-2:cubic-bezier(.5,-0.50,.75,1);--ease-elastic-in-3:cubic-bezier(.5,-0.75,.75,1);--ease-elastic-in-4:cubic-bezier(.5,-1.00,.75,1);--ease-elastic-in-5:cubic-bezier(.5,-1.25,.75,1);--ease-elastic-in-out-1:cubic-bezier(.5,-.1,.1,1.5);--ease-elastic-in-out-2:cubic-bezier(.5,-.3,.1,1.5);--ease-elastic-in-out-3:cubic-bezier(.5,-.5,.1,1.5);--ease-elastic-in-out-4:cubic-bezier(.5,-.7,.1,1.5);--ease-elastic-in-out-5:cubic-bezier(.5,-.9,.1,1.5);--ease-step-1:steps(2);--ease-step-2:steps(3);--ease-step-3:steps(4);--ease-step-4:steps(7);--ease-step-5:steps(10);--ease-elastic-1:var(--ease-elastic-out-1);--ease-elastic-2:var(--ease-elastic-out-2);--ease-elastic-3:var(--ease-elastic-out-3);--ease-elastic-4:var(--ease-elastic-out-4);--ease-elastic-5:var(--ease-elastic-out-5);--ease-squish-1:var(--ease-elastic-in-out-1);--ease-squish-2:var(--ease-elastic-in-out-2);--ease-squish-3:var(--ease-elastic-in-out-3);--ease-squish-4:var(--ease-elastic-in-out-4);--ease-squish-5:var(--ease-elastic-in-out-5);--ease-spring-1:linear(0,0.006,0.025 2.8%,0.101 6.1%,0.539 18.9%,0.721 25.3%,0.849 31.5%,0.937 38.1%,0.968 41.8%,0.991 45.7%,1.006 50.1%,1.015 55%,1.017 63.9%,1.001);--ease-spring-2:linear(0,0.007,0.029 2.2%,0.118 4.7%,0.625 14.4%,0.826 19%,0.902,0.962,1.008 26.1%,1.041 28.7%,1.064 32.1%,1.07 36%,1.061 40.5%,1.015 53.4%,0.999 61.6%,0.995 71.2%,1);--ease-spring-3:linear(0,0.009,0.035 2.1%,0.141 4.4%,0.723 12.9%,0.938 16.7%,1.017,1.077,1.121,1.149 24.3%,1.159,1.163,1.161,1.154 29.9%,1.129 32.8%,1.051 39.6%,1.017 43.1%,0.991,0.977 51%,0.974 53.8%,0.975 57.1%,0.997 69.8%,1.003 76.9%,1);--ease-spring-4:linear(0,0.009,0.037 1.7%,0.153 3.6%,0.776 10.3%,1.001,1.142 16%,1.185,1.209 19%,1.215 19.9% 20.8%,1.199,1.165 25%,1.056 30.3%,1.008 33%,0.973,0.955 39.2%,0.953 41.1%,0.957 43.3%,0.998 53.3%,1.009 59.1% 63.7%,0.998 78.9%,1);--ease-spring-5:linear(0,0.01,0.04 1.6%,0.161 3.3%,0.816 9.4%,1.046,1.189 14.4%,1.231,1.254 17%,1.259,1.257 18.6%,1.236,1.194 22.3%,1.057 27%,0.999 29.4%,0.955 32.1%,0.942,0.935 34.9%,0.933,0.939 38.4%,1 47.3%,1.011,1.017 52.6%,1.016 56.4%,1 65.2%,0.996 70.2%,1.001 87.2%,1);--ease-bounce-1:linear(0,0.004,0.016,0.035,0.063,0.098,0.141,0.191,0.25,0.316,0.391 36.8%,0.563,0.766,1 58.8%,0.946,0.908 69.1%,0.895,0.885,0.879,0.878,0.879,0.885,0.895,0.908 89.7%,0.946,1);--ease-bounce-2:linear(0,0.004,0.016,0.035,0.063,0.098,0.141 15.1%,0.25,0.391,0.562,0.765,1,0.892 45.2%,0.849,0.815,0.788,0.769,0.757,0.753,0.757,0.769,0.788,0.815,0.85,0.892 75.2%,1 80.2%,0.973,0.954,0.943,0.939,0.943,0.954,0.973,1);--ease-bounce-3:linear(0,0.004,0.016,0.035,0.062,0.098,0.141 11.4%,0.25,0.39,0.562,0.764,1 30.3%,0.847 34.8%,0.787,0.737,0.699,0.672,0.655,0.65,0.656,0.672,0.699,0.738,0.787,0.847 61.7%,1 66.2%,0.946,0.908,0.885 74.2%,0.879,0.878,0.879,0.885 79.5%,0.908,0.946,1 87.4%,0.981,0.968,0.96,0.957,0.96,0.968,0.981,1);--ease-bounce-4:linear(0,0.004,0.016 3%,0.062,0.141,0.25,0.391,0.562 18.2%,1 24.3%,0.81,0.676 32.3%,0.629,0.595,0.575,0.568,0.575,0.595,0.629,0.676 48.2%,0.811,1 56.2%,0.918,0.86,0.825,0.814,0.825,0.86,0.918,1 77.2%,0.94 80.6%,0.925,0.92,0.925,0.94 87.5%,1 90.9%,0.974,0.965,0.974,1);--ease-bounce-5:linear(0,0.004,0.016 2.5%,0.063,0.141,0.25 10.1%,0.562,1 20.2%,0.783,0.627,0.534 30.9%,0.511,0.503,0.511,0.534 38%,0.627,0.782,1 48.7%,0.892,0.815,0.769 56.3%,0.757,0.753,0.757,0.769 61.3%,0.815,0.892,1 68.8%,0.908 72.4%,0.885,0.878,0.885,0.908 79.4%,1 83%,0.954 85.5%,0.943,0.939,0.943,0.954 90.5%,1 93%,0.977,0.97,0.977,1)}
.sun-and-moon>:is(.moon,.sun,.sun-beams){transform-origin:center center}.sun-and-moon>:is(.moon,.sun){fill:var(--icon-fill)}.theme-toggle:is(:hover,:focus-visible)>.sun-and-moon>:is(.moon,.sun){fill:var(--icon-fill-hover)}.sun-and-moon>.sun-beams{stroke:var(--icon-fill);stroke-width:2px}.theme-toggle:is(:hover,:focus-visible) .sun-and-moon>.sun-beams{stroke:var(--icon-fill-hover)}[data-theme=dark] .sun-and-moon>.sun{transform:scale(1.75)}[data-theme=dark] .sun-and-moon>.sun-beams{opacity:0}[data-theme=dark] .sun-and-moon>.moon>circle{transform:translate(-7px)}@supports (cx: 1){[data-theme=dark] .sun-and-moon>.moon>circle{transform:translate(0);cx:17}}@media (prefers-reduced-motion: no-preference){.sun-and-moon>.sun{transition:transform .5s var(--ease-elastic-3)}.sun-and-moon>.sun-beams{transition:transform .5s var(--ease-elastic-4),opacity .5s var(--ease-3)}.sun-and-moon .moon>circle{transition:transform .25s var(--ease-out-5)}@supports (cx: 1){.sun-and-moon .moon>circle{transition:cx .25s var(--ease-out-5)}}[data-theme=dark] .sun-and-moon>.sun{transform:scale(1.75);transition-timing-function:var(--ease-3);transition-duration:.25s}[data-theme=dark] .sun-and-moon>.sun-beams{transform:rotate(-25deg);transition-duration:.15s}[data-theme=dark] .sun-and-moon>.moon>circle{transition-delay:.25s;transition-duration:.5s}}.theme-toggle{position:absolute;right:0;margin:0.5rem 1rem;--size: 2rem;--icon-fill: hsl(210 10% 30%);--icon-fill-hover: hsl(210 10% 15%);background:none;border:none;padding:0;inline-size:var(--size);block-size:var(--size);aspect-ratio:1;border-radius:50%;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;outline-offset:5px}.theme-toggle>svg{inline-size:100%;block-size:100%;stroke-linecap:round}[data-theme=dark] .theme-toggle{--icon-fill: hsl(210 10% 70%);--icon-fill-hover: hsl(210 15% 90%) }@media (hover: none){.theme-toggle{--size: 48px}}
html[data-theme="light"] {
color-scheme: light;
body { font-family: system-ui; padding: 0 30px 30px 30px; width: min-content; display: inline-block; background-color: #FFFFFF; color: #1F1F1F; }
h1, h2 { border-bottom: solid 1px #CCCCCC;}
h1, h2, h3 { padding-bottom: 0.3em; }
table { border-collapse: collapse !important; margin-top: 3px !important; width: 100%; display: inline-table; margin-bottom: 20px !important; }
td, th { padding: 6px 13px; border: 1px solid #CCCCCC; text-align: right; white-space: nowrap; color: #000000; }
tr { background-color: #FFFFFF !important; border-top: 1px solid #CCCCCC; }
tr:nth-child(even):not(.divider) { background: #F8F8F8 !important; }
tr.divider { border: 0; font-size: 10px; }
tr.divider td { padding: 0; border: 0; }
pre { background: #EFEFEF; padding: 0 1em; color: #1F1F1F; }
thead th { background-color: #EFEFEF; color: #1F1F1F; }
tbody tr:not(.divider):hover { background-color: #EFEFEF !important; border: 2px solid #ADADAD; }
.created-by { text-align: center; margin-bottom: -20px !important; font-weight: bold; }
.dataTables_wrapper .dataTables_filter input {border: 1px solid #AAAAAA;}
input[type="search"] { font-size: 1em !important; padding: 9px 12px !important; border: 1px solid #AAAAAA; outline: none;}
input[type="search"]:hover,input[type="search"]:focus { border-color: #666; }
.dataTable thead th:hover { background-color: #E0E0E0; }
div.dt-buttons > .dt-button {border: 1px solid #AAAAAA;}
div.dt-button-collection{background-color: #FFFFFF;}
}
html[data-theme="dark"] {
color-scheme: dark;
body { font-family: system-ui; padding: 0 30px 30px 30px; width: min-content; display: inline-block; background-color: #121212; color: #E0E0E0; }
h1, h2 { border-bottom: solid 1px #444444; }
h1, h2, h3 { padding-bottom: 0.3em; }
table { border-collapse: collapse !important; margin-top: 3px !important; width: 100%; display: inline-table; margin-bottom: 20px !important; }
td, th { padding: 6px 13px; border: 1px solid #444444; text-align: right; white-space: nowrap; color: black; }
tr { background-color: #1E1E1E !important; border-top: 1px solid #444444; }
tr:nth-child(even):not(.divider) { background: #262626 !important }
tr.divider { border: 0; font-size: 10px; }
tr.divider td { padding: 0; border: 0; }
pre { background: #2E2E2E; padding: 0 1em; color: #E0E0E0; }
thead th { background-color: #2E2E2E; color: #E0E0E0; }
tbody tr:not(.divider):hover { background-color: #2E2E2E !important; border: 2px solid #777777; }
.created-by { text-align: center; margin-bottom: -20px !important; font-weight: bold; }
td:not([hasBackground]) { filter: invert(1); }
input[type="search"] { font-size: 1em !important; padding: 9px 12px !important; border: 1px solid #444444; outline: none; }
input[type="search"]:hover,input[type="search"]:focus { border-color: #666666; }
.dataTable thead th:hover { background-color: #222222; }
div.dt-buttons > .dt-button {border: 1px solid #444444;}
div.dt-button-collection{background-color: #2B2B2B;}
}
</style>
</head>
<body>
<button class="theme-toggle" id="theme-toggle" title="Toggles light & dark" aria-label="auto" aria-live="polite">
<svg class="sun-and-moon" aria-hidden="true" width="24" height="24" viewBox="0 0 24 24">
<mask class="moon" id="moon-mask">
<rect x="0" y="0" width="100%" height="100%" fill="white" />
<circle cx="24" cy="10" r="6" fill="black" />
</mask>
<circle class="sun" cx="12" cy="12" r="6" mask="url(#moon-mask)" fill="currentColor" />
<g class="sun-beams" stroke="currentColor">
<line x1="12" y1="1" x2="12" y2="3" />
<line x1="12" y1="21" x2="12" y2="23" />
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
<line x1="1" y1="12" x2="3" y2="12" />
<line x1="21" y1="12" x2="23" y2="12" />
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
</g>
</svg>
</button>
<h1>Performance Comparison between for, foreach, and ForEeach() method</h1>
<pre>
<code>
BenchmarkDotNet v0.14.0, Windows 11 (10.0.22631.3958/23H2/2023Update/SunValley3)
AMD Ryzen 7 5800H with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK 8.0.304
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
ShortRun-.NET 5.0 : .NET 5.0.17 (5.0.1722.21314), X64 RyuJIT AVX2
ShortRun-.NET 6.0 : .NET 6.0.32 (6.0.3224.31407), X64 RyuJIT AVX2
ShortRun-.NET 7.0 : .NET 7.0.20 (7.0.2024.26716), X64 RyuJIT AVX2
ShortRun-.NET 8.0 : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
ShortRun-.NET Core 3.0 : .NET Core 3.0.3 (CoreCLR 4.700.20.6603, CoreFX 4.700.20.6701), X64 RyuJIT AVX2
ShortRun-.NET Core 3.1 : .NET Core 3.1.32 (CoreCLR 4.700.22.55902, CoreFX 4.700.22.56512), X64 RyuJIT AVX2
IterationCount=3 LaunchCount=1 WarmupCount=3
</code>
</pre>
<h2>Comparison: Mean</h2>
<table>
<thead>
<tr>
<th>Method</th><th>Categories</th><th>Length</th><th>.NET Core 3.0</th><th>.NET Core 3.1</th><th>.NET 5.0</th><th>.NET 6.0</th><th>.NET 7.0</th><th>.NET 8.0</th></tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">for</td>
<td style="text-align: left; background-color: #FFCCFF"hasBackground>Array</td>
<td style="background-color: #FFCCFF"hasBackground>1000</td>
<td style="background-color: #99FF99"hasBackground><strong>293.0 ns</strong></td>
<td style="background-color: #A7FF99"hasBackground>294.6 ns</td>
<td style="background-color: #9BFF99"hasBackground>246.7 ns</td>
<td style="background-color: #99FF99"hasBackground>245.4 ns</td>
<td style="background-color: #9BFF99"hasBackground>243.9 ns</td>
<td style="background-color: #A0FF99"hasBackground>242.3 ns</td>
</tr>
<tr>
<td style="text-align: left">foreach</td>
<td style="text-align: left; background-color: #FFCCFF"hasBackground>Array</td>
<td style="background-color: #FFCCFF"hasBackground>1000</td>
<td style="background-color: #D0FF99"hasBackground>476.0 ns</td>
<td style="background-color: #99FF99"hasBackground><strong>242.9 ns</strong></td>
<td style="background-color: #99FF99"hasBackground><strong>240.5 ns</strong></td>
<td style="background-color: #99FF99"hasBackground><strong>243.3 ns</strong></td>
<td style="background-color: #99FF99"hasBackground><strong>239.2 ns</strong></td>
<td style="background-color: #99FF99"hasBackground><strong>237.9 ns</strong></td>
</tr>
<tr>
<td style="text-align: left">ForEach()</td>
<td style="text-align: left; background-color: #FFCCFF"hasBackground>Array</td>
<td style="background-color: #FFCCFF"hasBackground>1000</td>
<td style="background-color: #FF9999"hasBackground>1,433.8 ns</td>
<td style="background-color: #FF9999"hasBackground>1,674.4 ns</td>
<td style="background-color: #FF9999"hasBackground>1,444.4 ns</td>
<td style="background-color: #FF9999"hasBackground>1,434.5 ns</td>
<td style="background-color: #FF9999"hasBackground>1,432.3 ns</td>
<td style="background-color: #A2FF99"hasBackground>243.6 ns</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Method</th><th>Categories</th><th>Length</th><th>.NET Core 3.0</th><th>.NET Core 3.1</th><th>.NET 5.0</th><th>.NET 6.0</th><th>.NET 7.0</th><th>.NET 8.0</th></tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">for</td>
<td style="text-align: left; background-color: #CCFFFF"hasBackground>List</td>
<td style="background-color: #CCFFFF"hasBackground>1000</td>
<td style="background-color: #99FF99"hasBackground><strong>480.3 ns</strong></td>
<td style="background-color: #99FF99"hasBackground><strong>479.9 ns</strong></td>
<td style="background-color: #99FF99"hasBackground><strong>478.0 ns</strong></td>
<td style="background-color: #99FF99"hasBackground><strong>392.4 ns</strong></td>
<td style="background-color: #99FF99"hasBackground><strong>477.6 ns</strong></td>
<td style="background-color: #99FF99"hasBackground><strong>394.7 ns</strong></td>
</tr>
<tr>
<td style="text-align: left">ForEach()</td>
<td style="text-align: left; background-color: #CCFFFF"hasBackground>List</td>
<td style="background-color: #CCFFFF"hasBackground>1000</td>
<td style="background-color: #FFD199"hasBackground>1,562.5 ns</td>
<td style="background-color: #FF9999"hasBackground>1,737.7 ns</td>
<td style="background-color: #FFCF99"hasBackground>1,684.6 ns</td>
<td style="background-color: #FF9999"hasBackground>1,675.2 ns</td>
<td style="background-color: #FF9999"hasBackground>1,572.6 ns</td>
<td style="background-color: #FFF899"hasBackground>619.3 ns</td>
</tr>
<tr>
<td style="text-align: left">foreach</td>
<td style="text-align: left; background-color: #CCFFFF"hasBackground>List</td>
<td style="background-color: #CCFFFF"hasBackground>1000</td>
<td style="background-color: #FF9999"hasBackground>1,759.1 ns</td>
<td style="background-color: #FFB499"hasBackground>1,693.5 ns</td>
<td style="background-color: #FF9999"hasBackground>1,882.4 ns</td>
<td style="background-color: #E6FF99"hasBackground>718.4 ns</td>
<td style="background-color: #9DFF99"hasBackground>489.2 ns</td>
<td style="background-color: #DEFF99"hasBackground>480.1 ns</td>
</tr>
</tbody>
</table>
<div class="created-by">Created by <a href="https://github.com/mjebrahimi/BenchmarkDotNetVisualizer"><strong>BenchmarkDotNetVisualizer</strong></a></div>
</body>
<script>
const storageKey = "theme-preference";
const getColorPreference = () => {
if (localStorage.getItem(storageKey))
return localStorage.getItem(storageKey);
else
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
};
const theme = { value: getColorPreference() };
const applyPreference = () => {
document.firstElementChild.setAttribute("data-theme", theme.value);
document.querySelector("#theme-toggle")?.setAttribute("aria-label", theme.value);
};
const setPreference = () => {
localStorage.setItem(storageKey, theme.value);
applyPreference();
};
const onClick = () => {
theme.value = theme.value === "light" ? "dark" : "light";
setPreference();
};
if (localStorage.getItem(storageKey) == null) {
//set default theme if no preference is set
theme.value = "dark";
setPreference();
}
applyPreference();
window.onload = () => {
applyPreference();
document.querySelector("#theme-toggle").addEventListener("click", onClick);
};
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", ({ matches: isDark }) => {
theme.value = isDark ? "dark" : "light";
setPreference();
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/colreorder/1.5.4/js/dataTables.colReorder.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.2/js/buttons.colVis.min.js"></script>
<script>
$(document).ready(function () {
DataTable.ext.type.order["custom-orderer-pre"] = function (d) {
d = d.replace(/(<([^>]+)>)/gi, ""); //remove html tags
if (!d.match(/^\d/))
//if not started with number
return d;
var regex = /[\d,]+(?:\.\d+)?/;
var number = d.match(regex)[0].replace(/,/g, ""); //extract number
return parseFloat(number); //Number
};
$("table").DataTable({
info: false,
paging: false,
colReorder: true,
order: [], //remove default order
columnDefs: [
{
type: "custom-orderer",
targets: "_all",
},
],
dom: "Bfrtip",
buttons: ["colvis"],
});
});
</script>
</html>