Reduce calls to malloc in map (#101)

Reduce the number of malloc calls in map. Improves efficiency by 40%.
This commit is contained in:
Bailey Thompson
2020-08-15 02:44:41 -04:00
committed by GitHub
parent ac725ef147
commit fd3d3fc8b8
4 changed files with 334 additions and 289 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2019 Bailey Thompson
* Copyright (c) 2017-2020 Bailey Thompson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -32,12 +32,11 @@
typedef struct internal_map *map;
/* Starting */
map map_init(size_t key_size,
size_t value_size,
map map_init(size_t key_size, size_t value_size,
int (*comparator)(const void *const one, const void *const two));
/* Capacity */
int map_size(map me);
size_t map_size(map me);
int map_is_empty(map me);
/* Accessing */