Skip to content

(A stack-based implemented) vectors in C written using preprocessor macros. Use C11+ for defined behaviour!

Notifications You must be signed in to change notification settings

burntfalafel/st_vector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Vectors in C

A lite-weight preprocessor macro only library which replicates std::vector with minimum overhead!. Each of the tests can be compiled using

clang -g3 -Wall test/main.c -Iinclude/ && ./a.out

Why use it?

Using inline funcions may dirty the code a bit after the preprocessing stage, but it is worth it!

Timed output for a char input (st_dyn_timed_tests.c)

Dynamic memory allocation uses this address: 0x562bc1a7e2a0
A dynamic memory allocation which uses linked lists use time   0.00281

Static memory allocation uses this address: 0x7fff01b14630
A static allocation which uses arrays use time   0.00001

Dynamic memory vector allocation uses this address: 0x562bc1a863b0
Dynamic allocation which uses vectors use time   0.00002

Timed output for a int input (st_int_timed_tests.c)

A dynamic memory allocation which uses linked lists use time   0.00291

Static memory allocation uses this address: 0x7ffc4306e390
A static allocation which uses arrays use time   0.00001

Dynamic memory vector allocation uses this address: 0x5561c20a23b0
Dynamic allocation which uses vectors use time   0.00003

About

(A stack-based implemented) vectors in C written using preprocessor macros. Use C11+ for defined behaviour!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages