lunixbochs / glshim

OpenGL 1.x driver shim for OpenGL ES devices.
https://boards.openpandora.org/topic/11506-glshim/
MIT License
159 stars 32 forks source link

evaluate using (linked vectors?) for tack_t #171

Open lunixbochs opened 7 years ago

lunixbochs commented 7 years ago

currently:

malloc(capacity)
on push: if cur >= capacity:
    capacity *= 2; realloc

potentially:

malloc(<initial capacity chosen by profiling, likely at least 9>)
push:
    if pos >= capacity:
        capacity += initial
        last = last->next = malloc(initial)
    last[pos%len] = val
    pos += 1
pop/peek:
    val = last[pos%len]
    if pop:
        cur -= 1
        if pos < capacity - len:
            last = last->prev
            free(last->next);
            last->next = NULL;
    return val