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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
|
/* benchmarksorts.c generated by valac 0.16.1, the Vala compiler
* generated from benchmarksorts.vala, do not modify */
/* benchmarksorts.vala
*
* Copyright (C) 2008 Jürg Billeter
* Copyright (C) 2009 Didier Villevalois
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Didier 'Ptitjes Villevalois <ptitjes@free.fr>
*/
#include <glib.h>
#include <glib-object.h>
#include <gee-internals.h>
#include <stdlib.h>
#include <string.h>
#define GEE_BENCHMARK_TYPE_ALGORITHM (gee_benchmark_algorithm_get_type ())
#define GEE_BENCHMARK_ALGORITHM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_ALGORITHM, GeeBenchmarkAlgorithm))
#define GEE_BENCHMARK_IS_ALGORITHM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_ALGORITHM))
#define GEE_BENCHMARK_ALGORITHM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_BENCHMARK_TYPE_ALGORITHM, GeeBenchmarkAlgorithmIface))
typedef struct _GeeBenchmarkAlgorithm GeeBenchmarkAlgorithm;
typedef struct _GeeBenchmarkAlgorithmIface GeeBenchmarkAlgorithmIface;
#define GEE_BENCHMARK_TYPE_TIM_SORT (gee_benchmark_tim_sort_get_type ())
#define GEE_BENCHMARK_TIM_SORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_TIM_SORT, GeeBenchmarkTimSort))
#define GEE_BENCHMARK_TIM_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_TIM_SORT, GeeBenchmarkTimSortClass))
#define GEE_BENCHMARK_IS_TIM_SORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_TIM_SORT))
#define GEE_BENCHMARK_IS_TIM_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_TIM_SORT))
#define GEE_BENCHMARK_TIM_SORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_TIM_SORT, GeeBenchmarkTimSortClass))
typedef struct _GeeBenchmarkTimSort GeeBenchmarkTimSort;
typedef struct _GeeBenchmarkTimSortClass GeeBenchmarkTimSortClass;
typedef struct _GeeBenchmarkTimSortPrivate GeeBenchmarkTimSortPrivate;
#define GEE_BENCHMARK_TYPE_MERGE_SORT (gee_benchmark_merge_sort_get_type ())
#define GEE_BENCHMARK_MERGE_SORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_MERGE_SORT, GeeBenchmarkMergeSort))
#define GEE_BENCHMARK_MERGE_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_MERGE_SORT, GeeBenchmarkMergeSortClass))
#define GEE_BENCHMARK_IS_MERGE_SORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_MERGE_SORT))
#define GEE_BENCHMARK_IS_MERGE_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_MERGE_SORT))
#define GEE_BENCHMARK_MERGE_SORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_MERGE_SORT, GeeBenchmarkMergeSortClass))
typedef struct _GeeBenchmarkMergeSort GeeBenchmarkMergeSort;
typedef struct _GeeBenchmarkMergeSortClass GeeBenchmarkMergeSortClass;
typedef struct _GeeBenchmarkMergeSortPrivate GeeBenchmarkMergeSortPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define GEE_BENCHMARK_TYPE_GENERATOR (gee_benchmark_generator_get_type ())
#define GEE_BENCHMARK_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_GENERATOR, GeeBenchmarkGenerator))
#define GEE_BENCHMARK_IS_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_GENERATOR))
#define GEE_BENCHMARK_GENERATOR_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_BENCHMARK_TYPE_GENERATOR, GeeBenchmarkGeneratorIface))
typedef struct _GeeBenchmarkGenerator GeeBenchmarkGenerator;
typedef struct _GeeBenchmarkGeneratorIface GeeBenchmarkGeneratorIface;
#define GEE_BENCHMARK_TYPE_RANDOM_INT32 (gee_benchmark_random_int32_get_type ())
#define GEE_BENCHMARK_RANDOM_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_RANDOM_INT32, GeeBenchmarkRandomInt32))
#define GEE_BENCHMARK_RANDOM_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_RANDOM_INT32, GeeBenchmarkRandomInt32Class))
#define GEE_BENCHMARK_IS_RANDOM_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_RANDOM_INT32))
#define GEE_BENCHMARK_IS_RANDOM_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_RANDOM_INT32))
#define GEE_BENCHMARK_RANDOM_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_RANDOM_INT32, GeeBenchmarkRandomInt32Class))
typedef struct _GeeBenchmarkRandomInt32 GeeBenchmarkRandomInt32;
typedef struct _GeeBenchmarkRandomInt32Class GeeBenchmarkRandomInt32Class;
#define GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32 (gee_benchmark_fixed_variance_int32_get_type ())
#define GEE_BENCHMARK_FIXED_VARIANCE_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32, GeeBenchmarkFixedVarianceInt32))
#define GEE_BENCHMARK_FIXED_VARIANCE_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32, GeeBenchmarkFixedVarianceInt32Class))
#define GEE_BENCHMARK_IS_FIXED_VARIANCE_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32))
#define GEE_BENCHMARK_IS_FIXED_VARIANCE_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32))
#define GEE_BENCHMARK_FIXED_VARIANCE_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_FIXED_VARIANCE_INT32, GeeBenchmarkFixedVarianceInt32Class))
typedef struct _GeeBenchmarkFixedVarianceInt32 GeeBenchmarkFixedVarianceInt32;
typedef struct _GeeBenchmarkFixedVarianceInt32Class GeeBenchmarkFixedVarianceInt32Class;
#define GEE_BENCHMARK_TYPE_MOUNTS_INT32 (gee_benchmark_mounts_int32_get_type ())
#define GEE_BENCHMARK_MOUNTS_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_MOUNTS_INT32, GeeBenchmarkMountsInt32))
#define GEE_BENCHMARK_MOUNTS_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_MOUNTS_INT32, GeeBenchmarkMountsInt32Class))
#define GEE_BENCHMARK_IS_MOUNTS_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_MOUNTS_INT32))
#define GEE_BENCHMARK_IS_MOUNTS_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_MOUNTS_INT32))
#define GEE_BENCHMARK_MOUNTS_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_MOUNTS_INT32, GeeBenchmarkMountsInt32Class))
typedef struct _GeeBenchmarkMountsInt32 GeeBenchmarkMountsInt32;
typedef struct _GeeBenchmarkMountsInt32Class GeeBenchmarkMountsInt32Class;
#define GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32 (gee_benchmark_reverse_sorted_int32_get_type ())
#define GEE_BENCHMARK_REVERSE_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32, GeeBenchmarkReverseSortedInt32))
#define GEE_BENCHMARK_REVERSE_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32, GeeBenchmarkReverseSortedInt32Class))
#define GEE_BENCHMARK_IS_REVERSE_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32))
#define GEE_BENCHMARK_IS_REVERSE_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32))
#define GEE_BENCHMARK_REVERSE_SORTED_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_REVERSE_SORTED_INT32, GeeBenchmarkReverseSortedInt32Class))
typedef struct _GeeBenchmarkReverseSortedInt32 GeeBenchmarkReverseSortedInt32;
typedef struct _GeeBenchmarkReverseSortedInt32Class GeeBenchmarkReverseSortedInt32Class;
#define GEE_BENCHMARK_TYPE_SORTED_INT32 (gee_benchmark_sorted_int32_get_type ())
#define GEE_BENCHMARK_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_SORTED_INT32, GeeBenchmarkSortedInt32))
#define GEE_BENCHMARK_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_SORTED_INT32, GeeBenchmarkSortedInt32Class))
#define GEE_BENCHMARK_IS_SORTED_INT32(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_SORTED_INT32))
#define GEE_BENCHMARK_IS_SORTED_INT32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_SORTED_INT32))
#define GEE_BENCHMARK_SORTED_INT32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_SORTED_INT32, GeeBenchmarkSortedInt32Class))
typedef struct _GeeBenchmarkSortedInt32 GeeBenchmarkSortedInt32;
typedef struct _GeeBenchmarkSortedInt32Class GeeBenchmarkSortedInt32Class;
#define GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY (gee_benchmark_array_list_factory_get_type ())
#define GEE_BENCHMARK_ARRAY_LIST_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, GeeBenchmarkArrayListFactory))
#define GEE_BENCHMARK_ARRAY_LIST_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, GeeBenchmarkArrayListFactoryClass))
#define GEE_BENCHMARK_IS_ARRAY_LIST_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY))
#define GEE_BENCHMARK_IS_ARRAY_LIST_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY))
#define GEE_BENCHMARK_ARRAY_LIST_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_ARRAY_LIST_FACTORY, GeeBenchmarkArrayListFactoryClass))
typedef struct _GeeBenchmarkArrayListFactory GeeBenchmarkArrayListFactory;
typedef struct _GeeBenchmarkArrayListFactoryClass GeeBenchmarkArrayListFactoryClass;
#define GEE_BENCHMARK_TYPE_FACTORY (gee_benchmark_factory_get_type ())
#define GEE_BENCHMARK_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_FACTORY, GeeBenchmarkFactory))
#define GEE_BENCHMARK_IS_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_FACTORY))
#define GEE_BENCHMARK_FACTORY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_BENCHMARK_TYPE_FACTORY, GeeBenchmarkFactoryIface))
typedef struct _GeeBenchmarkFactory GeeBenchmarkFactory;
typedef struct _GeeBenchmarkFactoryIface GeeBenchmarkFactoryIface;
#define GEE_BENCHMARK_TYPE_BENCHMARK (gee_benchmark_benchmark_get_type ())
#define GEE_BENCHMARK_BENCHMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_BENCHMARK_TYPE_BENCHMARK, GeeBenchmarkBenchmark))
#define GEE_BENCHMARK_BENCHMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_BENCHMARK_TYPE_BENCHMARK, GeeBenchmarkBenchmarkClass))
#define GEE_BENCHMARK_IS_BENCHMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_BENCHMARK_TYPE_BENCHMARK))
#define GEE_BENCHMARK_IS_BENCHMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_BENCHMARK_TYPE_BENCHMARK))
#define GEE_BENCHMARK_BENCHMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_BENCHMARK_TYPE_BENCHMARK, GeeBenchmarkBenchmarkClass))
typedef struct _GeeBenchmarkBenchmark GeeBenchmarkBenchmark;
typedef struct _GeeBenchmarkBenchmarkClass GeeBenchmarkBenchmarkClass;
struct _GeeBenchmarkAlgorithmIface {
GTypeInterface parent_iface;
void (*process_collection) (GeeBenchmarkAlgorithm* self, GeeCollection* collection);
const gchar* (*get_name) (GeeBenchmarkAlgorithm* self);
};
struct _GeeBenchmarkTimSort {
GObject parent_instance;
GeeBenchmarkTimSortPrivate * priv;
};
struct _GeeBenchmarkTimSortClass {
GObjectClass parent_class;
};
struct _GeeBenchmarkTimSortPrivate {
GType g_type;
GBoxedCopyFunc g_dup_func;
GDestroyNotify g_destroy_func;
};
struct _GeeBenchmarkMergeSort {
GObject parent_instance;
GeeBenchmarkMergeSortPrivate * priv;
};
struct _GeeBenchmarkMergeSortClass {
GObjectClass parent_class;
};
struct _GeeBenchmarkMergeSortPrivate {
GType g_type;
GBoxedCopyFunc g_dup_func;
GDestroyNotify g_destroy_func;
};
struct _GeeBenchmarkGeneratorIface {
GTypeInterface parent_iface;
void (*generate_collection) (GeeBenchmarkGenerator* self, gint size, GeeCollection* collection);
const gchar* (*get_name) (GeeBenchmarkGenerator* self);
};
struct _GeeBenchmarkFactoryIface {
GTypeInterface parent_iface;
GeeCollection* (*create) (GeeBenchmarkFactory* self);
GeeCollection* (*copy) (GeeBenchmarkFactory* self, GeeCollection* collection);
};
static gpointer gee_benchmark_tim_sort_parent_class = NULL;
static GeeBenchmarkAlgorithmIface* gee_benchmark_tim_sort_gee_benchmark_algorithm_parent_iface = NULL;
static gpointer gee_benchmark_merge_sort_parent_class = NULL;
static GeeBenchmarkAlgorithmIface* gee_benchmark_merge_sort_gee_benchmark_algorithm_parent_iface = NULL;
GType gee_benchmark_algorithm_get_type (void) G_GNUC_CONST;
GType gee_benchmark_tim_sort_get_type (void) G_GNUC_CONST;
#define GEE_BENCHMARK_TIM_SORT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_BENCHMARK_TYPE_TIM_SORT, GeeBenchmarkTimSortPrivate))
enum {
GEE_BENCHMARK_TIM_SORT_DUMMY_PROPERTY,
GEE_BENCHMARK_TIM_SORT_G_TYPE,
GEE_BENCHMARK_TIM_SORT_G_DUP_FUNC,
GEE_BENCHMARK_TIM_SORT_G_DESTROY_FUNC,
GEE_BENCHMARK_TIM_SORT_NAME
};
static void gee_benchmark_tim_sort_real_process_collection (GeeBenchmarkAlgorithm* base, GeeCollection* collection);
GeeBenchmarkTimSort* gee_benchmark_tim_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
GeeBenchmarkTimSort* gee_benchmark_tim_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
const gchar* gee_benchmark_algorithm_get_name (GeeBenchmarkAlgorithm* self);
static void _vala_gee_benchmark_tim_sort_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gee_benchmark_tim_sort_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
GType gee_benchmark_merge_sort_get_type (void) G_GNUC_CONST;
#define GEE_BENCHMARK_MERGE_SORT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_BENCHMARK_TYPE_MERGE_SORT, GeeBenchmarkMergeSortPrivate))
enum {
GEE_BENCHMARK_MERGE_SORT_DUMMY_PROPERTY,
GEE_BENCHMARK_MERGE_SORT_G_TYPE,
GEE_BENCHMARK_MERGE_SORT_G_DUP_FUNC,
GEE_BENCHMARK_MERGE_SORT_G_DESTROY_FUNC,
GEE_BENCHMARK_MERGE_SORT_NAME
};
static void gee_benchmark_merge_sort_real_process_collection (GeeBenchmarkAlgorithm* base, GeeCollection* collection);
void gee_merge_sort_sort (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare);
GeeBenchmarkMergeSort* gee_benchmark_merge_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
GeeBenchmarkMergeSort* gee_benchmark_merge_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
static void _vala_gee_benchmark_merge_sort_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gee_benchmark_merge_sort_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
void gee_benchmark_main (gchar** args, int args_length1);
GType gee_benchmark_generator_get_type (void) G_GNUC_CONST;
GeeBenchmarkRandomInt32* gee_benchmark_random_int32_new (void);
GeeBenchmarkRandomInt32* gee_benchmark_random_int32_construct (GType object_type);
GType gee_benchmark_random_int32_get_type (void) G_GNUC_CONST;
GeeBenchmarkFixedVarianceInt32* gee_benchmark_fixed_variance_int32_new (void);
GeeBenchmarkFixedVarianceInt32* gee_benchmark_fixed_variance_int32_construct (GType object_type);
GType gee_benchmark_fixed_variance_int32_get_type (void) G_GNUC_CONST;
GeeBenchmarkMountsInt32* gee_benchmark_mounts_int32_new (void);
GeeBenchmarkMountsInt32* gee_benchmark_mounts_int32_construct (GType object_type);
GType gee_benchmark_mounts_int32_get_type (void) G_GNUC_CONST;
GeeBenchmarkReverseSortedInt32* gee_benchmark_reverse_sorted_int32_new (void);
GeeBenchmarkReverseSortedInt32* gee_benchmark_reverse_sorted_int32_construct (GType object_type);
GType gee_benchmark_reverse_sorted_int32_get_type (void) G_GNUC_CONST;
GeeBenchmarkSortedInt32* gee_benchmark_sorted_int32_new (void);
GeeBenchmarkSortedInt32* gee_benchmark_sorted_int32_construct (GType object_type);
GType gee_benchmark_sorted_int32_get_type (void) G_GNUC_CONST;
GeeBenchmarkArrayListFactory* gee_benchmark_array_list_factory_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
GeeBenchmarkArrayListFactory* gee_benchmark_array_list_factory_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
GType gee_benchmark_array_list_factory_get_type (void) G_GNUC_CONST;
GType gee_benchmark_factory_get_type (void) G_GNUC_CONST;
GeeBenchmarkBenchmark* gee_benchmark_benchmark_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeBenchmarkFactory* factory, GeeList* algorithms, GeeList* generators, gint* sizes, int sizes_length1, gint iteration_count);
GeeBenchmarkBenchmark* gee_benchmark_benchmark_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeBenchmarkFactory* factory, GeeList* algorithms, GeeList* generators, gint* sizes, int sizes_length1, gint iteration_count);
GType gee_benchmark_benchmark_get_type (void) G_GNUC_CONST;
void gee_benchmark_benchmark_run (GeeBenchmarkBenchmark* self);
static void gee_benchmark_tim_sort_real_process_collection (GeeBenchmarkAlgorithm* base, GeeCollection* collection) {
GeeBenchmarkTimSort * self;
GeeCollection* _tmp0_;
self = (GeeBenchmarkTimSort*) base;
g_return_if_fail (collection != NULL);
_tmp0_ = collection;
gee_list_sort (GEE_LIST (_tmp0_), NULL);
}
GeeBenchmarkTimSort* gee_benchmark_tim_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) {
GeeBenchmarkTimSort * self = NULL;
self = (GeeBenchmarkTimSort*) g_object_new (object_type, NULL);
self->priv->g_type = g_type;
self->priv->g_dup_func = g_dup_func;
self->priv->g_destroy_func = g_destroy_func;
return self;
}
GeeBenchmarkTimSort* gee_benchmark_tim_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) {
return gee_benchmark_tim_sort_construct (GEE_BENCHMARK_TYPE_TIM_SORT, g_type, g_dup_func, g_destroy_func);
}
static const gchar* gee_benchmark_tim_sort_real_get_name (GeeBenchmarkAlgorithm* base) {
const gchar* result;
GeeBenchmarkTimSort* self;
self = (GeeBenchmarkTimSort*) base;
result = "TimSort";
return result;
}
static void gee_benchmark_tim_sort_class_init (GeeBenchmarkTimSortClass * klass) {
gee_benchmark_tim_sort_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (GeeBenchmarkTimSortPrivate));
G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_tim_sort_get_property;
G_OBJECT_CLASS (klass)->set_property = _vala_gee_benchmark_tim_sort_set_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_TIM_SORT_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_TIM_SORT_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_TIM_SORT_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_TIM_SORT_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}
static void gee_benchmark_tim_sort_gee_benchmark_algorithm_interface_init (GeeBenchmarkAlgorithmIface * iface) {
gee_benchmark_tim_sort_gee_benchmark_algorithm_parent_iface = g_type_interface_peek_parent (iface);
iface->process_collection = (void (*)(GeeBenchmarkAlgorithm*, GeeCollection*)) gee_benchmark_tim_sort_real_process_collection;
iface->get_name = gee_benchmark_tim_sort_real_get_name;
}
static void gee_benchmark_tim_sort_instance_init (GeeBenchmarkTimSort * self) {
self->priv = GEE_BENCHMARK_TIM_SORT_GET_PRIVATE (self);
}
GType gee_benchmark_tim_sort_get_type (void) {
static volatile gsize gee_benchmark_tim_sort_type_id__volatile = 0;
if (g_once_init_enter (&gee_benchmark_tim_sort_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkTimSortClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_tim_sort_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkTimSort), 0, (GInstanceInitFunc) gee_benchmark_tim_sort_instance_init, NULL };
static const GInterfaceInfo gee_benchmark_algorithm_info = { (GInterfaceInitFunc) gee_benchmark_tim_sort_gee_benchmark_algorithm_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
GType gee_benchmark_tim_sort_type_id;
gee_benchmark_tim_sort_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkTimSort", &g_define_type_info, 0);
g_type_add_interface_static (gee_benchmark_tim_sort_type_id, GEE_BENCHMARK_TYPE_ALGORITHM, &gee_benchmark_algorithm_info);
g_once_init_leave (&gee_benchmark_tim_sort_type_id__volatile, gee_benchmark_tim_sort_type_id);
}
return gee_benchmark_tim_sort_type_id__volatile;
}
static void _vala_gee_benchmark_tim_sort_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
GeeBenchmarkTimSort * self;
self = GEE_BENCHMARK_TIM_SORT (object);
switch (property_id) {
case GEE_BENCHMARK_TIM_SORT_NAME:
g_value_set_string (value, gee_benchmark_algorithm_get_name ((GeeBenchmarkAlgorithm*) self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void _vala_gee_benchmark_tim_sort_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
GeeBenchmarkTimSort * self;
self = GEE_BENCHMARK_TIM_SORT (object);
switch (property_id) {
case GEE_BENCHMARK_TIM_SORT_G_TYPE:
self->priv->g_type = g_value_get_gtype (value);
break;
case GEE_BENCHMARK_TIM_SORT_G_DUP_FUNC:
self->priv->g_dup_func = g_value_get_pointer (value);
break;
case GEE_BENCHMARK_TIM_SORT_G_DESTROY_FUNC:
self->priv->g_destroy_func = g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void gee_benchmark_merge_sort_real_process_collection (GeeBenchmarkAlgorithm* base, GeeCollection* collection) {
GeeBenchmarkMergeSort * self;
GCompareFunc _tmp0_ = NULL;
GCompareFunc compare;
GeeCollection* _tmp1_;
self = (GeeBenchmarkMergeSort*) base;
g_return_if_fail (collection != NULL);
_tmp0_ = gee_functions_get_compare_func_for (self->priv->g_type);
compare = _tmp0_;
_tmp1_ = collection;
gee_merge_sort_sort (self->priv->g_type, (GBoxedCopyFunc) self->priv->g_dup_func, self->priv->g_destroy_func, GEE_LIST (_tmp1_), compare);
}
GeeBenchmarkMergeSort* gee_benchmark_merge_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) {
GeeBenchmarkMergeSort * self = NULL;
self = (GeeBenchmarkMergeSort*) g_object_new (object_type, NULL);
self->priv->g_type = g_type;
self->priv->g_dup_func = g_dup_func;
self->priv->g_destroy_func = g_destroy_func;
return self;
}
GeeBenchmarkMergeSort* gee_benchmark_merge_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) {
return gee_benchmark_merge_sort_construct (GEE_BENCHMARK_TYPE_MERGE_SORT, g_type, g_dup_func, g_destroy_func);
}
static const gchar* gee_benchmark_merge_sort_real_get_name (GeeBenchmarkAlgorithm* base) {
const gchar* result;
GeeBenchmarkMergeSort* self;
self = (GeeBenchmarkMergeSort*) base;
result = "MergeSort";
return result;
}
static void gee_benchmark_merge_sort_class_init (GeeBenchmarkMergeSortClass * klass) {
gee_benchmark_merge_sort_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (GeeBenchmarkMergeSortPrivate));
G_OBJECT_CLASS (klass)->get_property = _vala_gee_benchmark_merge_sort_get_property;
G_OBJECT_CLASS (klass)->set_property = _vala_gee_benchmark_merge_sort_set_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_MERGE_SORT_G_TYPE, g_param_spec_gtype ("g-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_MERGE_SORT_G_DUP_FUNC, g_param_spec_pointer ("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_MERGE_SORT_G_DESTROY_FUNC, g_param_spec_pointer ("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_BENCHMARK_MERGE_SORT_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}
static void gee_benchmark_merge_sort_gee_benchmark_algorithm_interface_init (GeeBenchmarkAlgorithmIface * iface) {
gee_benchmark_merge_sort_gee_benchmark_algorithm_parent_iface = g_type_interface_peek_parent (iface);
iface->process_collection = (void (*)(GeeBenchmarkAlgorithm*, GeeCollection*)) gee_benchmark_merge_sort_real_process_collection;
iface->get_name = gee_benchmark_merge_sort_real_get_name;
}
static void gee_benchmark_merge_sort_instance_init (GeeBenchmarkMergeSort * self) {
self->priv = GEE_BENCHMARK_MERGE_SORT_GET_PRIVATE (self);
}
GType gee_benchmark_merge_sort_get_type (void) {
static volatile gsize gee_benchmark_merge_sort_type_id__volatile = 0;
if (g_once_init_enter (&gee_benchmark_merge_sort_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (GeeBenchmarkMergeSortClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_benchmark_merge_sort_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeBenchmarkMergeSort), 0, (GInstanceInitFunc) gee_benchmark_merge_sort_instance_init, NULL };
static const GInterfaceInfo gee_benchmark_algorithm_info = { (GInterfaceInitFunc) gee_benchmark_merge_sort_gee_benchmark_algorithm_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
GType gee_benchmark_merge_sort_type_id;
gee_benchmark_merge_sort_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeBenchmarkMergeSort", &g_define_type_info, 0);
g_type_add_interface_static (gee_benchmark_merge_sort_type_id, GEE_BENCHMARK_TYPE_ALGORITHM, &gee_benchmark_algorithm_info);
g_once_init_leave (&gee_benchmark_merge_sort_type_id__volatile, gee_benchmark_merge_sort_type_id);
}
return gee_benchmark_merge_sort_type_id__volatile;
}
static void _vala_gee_benchmark_merge_sort_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
GeeBenchmarkMergeSort * self;
self = GEE_BENCHMARK_MERGE_SORT (object);
switch (property_id) {
case GEE_BENCHMARK_MERGE_SORT_NAME:
g_value_set_string (value, gee_benchmark_algorithm_get_name ((GeeBenchmarkAlgorithm*) self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void _vala_gee_benchmark_merge_sort_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
GeeBenchmarkMergeSort * self;
self = GEE_BENCHMARK_MERGE_SORT (object);
switch (property_id) {
case GEE_BENCHMARK_MERGE_SORT_G_TYPE:
self->priv->g_type = g_value_get_gtype (value);
break;
case GEE_BENCHMARK_MERGE_SORT_G_DUP_FUNC:
self->priv->g_dup_func = g_value_get_pointer (value);
break;
case GEE_BENCHMARK_MERGE_SORT_G_DESTROY_FUNC:
self->priv->g_destroy_func = g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
void gee_benchmark_main (gchar** args, int args_length1) {
GeeArrayList* _tmp0_;
GeeArrayList* algorithms;
GeeBenchmarkTimSort* _tmp1_;
GeeBenchmarkTimSort* _tmp2_;
GeeBenchmarkMergeSort* _tmp3_;
GeeBenchmarkMergeSort* _tmp4_;
GeeArrayList* _tmp5_;
GeeArrayList* generators;
GeeBenchmarkRandomInt32* _tmp6_;
GeeBenchmarkRandomInt32* _tmp7_;
GeeBenchmarkFixedVarianceInt32* _tmp8_;
GeeBenchmarkFixedVarianceInt32* _tmp9_;
GeeBenchmarkMountsInt32* _tmp10_;
GeeBenchmarkMountsInt32* _tmp11_;
GeeBenchmarkReverseSortedInt32* _tmp12_;
GeeBenchmarkReverseSortedInt32* _tmp13_;
GeeBenchmarkSortedInt32* _tmp14_;
GeeBenchmarkSortedInt32* _tmp15_;
GeeBenchmarkArrayListFactory* _tmp16_;
GeeBenchmarkArrayListFactory* _tmp17_;
gint* _tmp18_ = NULL;
gint* _tmp19_;
gint _tmp19__length1;
GeeBenchmarkBenchmark* _tmp20_;
GeeBenchmarkBenchmark* _tmp21_;
GeeBenchmarkBenchmark* benchmark;
_tmp0_ = gee_array_list_new (GEE_BENCHMARK_TYPE_ALGORITHM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
algorithms = _tmp0_;
_tmp1_ = gee_benchmark_tim_sort_new (G_TYPE_INT, NULL, NULL);
_tmp2_ = _tmp1_;
gee_abstract_collection_add ((GeeAbstractCollection*) algorithms, (GeeBenchmarkAlgorithm*) _tmp2_);
_g_object_unref0 (_tmp2_);
_tmp3_ = gee_benchmark_merge_sort_new (G_TYPE_INT, NULL, NULL);
_tmp4_ = _tmp3_;
gee_abstract_collection_add ((GeeAbstractCollection*) algorithms, (GeeBenchmarkAlgorithm*) _tmp4_);
_g_object_unref0 (_tmp4_);
_tmp5_ = gee_array_list_new (GEE_BENCHMARK_TYPE_GENERATOR, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
generators = _tmp5_;
_tmp6_ = gee_benchmark_random_int32_new ();
_tmp7_ = _tmp6_;
gee_abstract_collection_add ((GeeAbstractCollection*) generators, (GeeBenchmarkGenerator*) _tmp7_);
_g_object_unref0 (_tmp7_);
_tmp8_ = gee_benchmark_fixed_variance_int32_new ();
_tmp9_ = _tmp8_;
gee_abstract_collection_add ((GeeAbstractCollection*) generators, (GeeBenchmarkGenerator*) _tmp9_);
_g_object_unref0 (_tmp9_);
_tmp10_ = gee_benchmark_mounts_int32_new ();
_tmp11_ = _tmp10_;
gee_abstract_collection_add ((GeeAbstractCollection*) generators, (GeeBenchmarkGenerator*) _tmp11_);
_g_object_unref0 (_tmp11_);
_tmp12_ = gee_benchmark_reverse_sorted_int32_new ();
_tmp13_ = _tmp12_;
gee_abstract_collection_add ((GeeAbstractCollection*) generators, (GeeBenchmarkGenerator*) _tmp13_);
_g_object_unref0 (_tmp13_);
_tmp14_ = gee_benchmark_sorted_int32_new ();
_tmp15_ = _tmp14_;
gee_abstract_collection_add ((GeeAbstractCollection*) generators, (GeeBenchmarkGenerator*) _tmp15_);
_g_object_unref0 (_tmp15_);
_tmp16_ = gee_benchmark_array_list_factory_new (G_TYPE_INT, NULL, NULL);
_tmp17_ = _tmp16_;
_tmp18_ = g_new0 (gint, 6);
_tmp18_[0] = 10;
_tmp18_[1] = 100;
_tmp18_[2] = 1000;
_tmp18_[3] = 10000;
_tmp18_[4] = 100000;
_tmp18_[5] = 1000000;
_tmp19_ = _tmp18_;
_tmp19__length1 = 6;
_tmp20_ = gee_benchmark_benchmark_new (G_TYPE_INT, NULL, NULL, (GeeBenchmarkFactory*) _tmp17_, (GeeList*) algorithms, (GeeList*) generators, _tmp19_, 6, 1000);
_tmp21_ = _tmp20_;
_tmp19_ = (g_free (_tmp19_), NULL);
_g_object_unref0 (_tmp17_);
benchmark = _tmp21_;
gee_benchmark_benchmark_run (benchmark);
_g_object_unref0 (benchmark);
_g_object_unref0 (generators);
_g_object_unref0 (algorithms);
}
int main (int argc, char ** argv) {
g_type_init ();
gee_benchmark_main (argv, argc);
return 0;
}
|