Is this behavior expected for the list accessor?! is it suppose to take so much time adding items to the list?!
when using accessors?!
if the backend code was something like (in pseudocode):
if (index == ds_list_size + 1)
ds_list_add(...);
else
ds_list_insert(...);
it should be faster!!
something really odd is happening:
as it is the same list... and it is already 100000 in size it shouldn't take more time.. should it!?
when using accessors?!
Code:
global.a = ds_list_create();
global.b = ds_list_create();
global.c = ds_list_create();
var i = 0;
var time = get_timer();
repeat(100000) {
global.a[| i++] = 12;
}
show_debug_message(get_timer()-time); // 5382399 micro
i = 100000
var time = get_timer();
repeat(100000) {
global.b[| i--] = 12;
}
show_debug_message(get_timer()-time); // 33399 micro
var time = get_timer();
repeat(100000) {
ds_list_add(global.c, 12);
}
show_debug_message(get_timer()-time); // 34842 micro
if the backend code was something like (in pseudocode):
if (index == ds_list_size + 1)
ds_list_add(...);
else
ds_list_insert(...);
it should be faster!!
something really odd is happening:
Code:
i = 100000
var time = get_timer();
repeat(100000) {
ds_list_insert(global.d, i--, 12);
}
show_debug_message(get_timer()-time); // 28095
var i = 0;
var time = get_timer();
repeat(100000) {
ds_list_insert(global.d, i++, 12);
}
show_debug_message(get_timer()-time); // 2705950
Last edited: