Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor array #71

Merged
merged 5 commits into from
Aug 8, 2020
Merged

Refactor array #71

merged 5 commits into from
Aug 8, 2020

Conversation

bkthomps
Copy link
Owner

@bkthomps bkthomps commented Aug 7, 2020

Relates to #67 and #68

Using this as a benchmark for speed:

int i;
int j;
for (i = 0; i < 20000; i++) {
    array me = array_init(10000, sizeof(int));
    for (j = 0; j < 10000; j++) {
        int get = 0xfacade;
        array_set(me, j, &j);
        array_get(&get, me, j);
        assert(get == j);
    }
    array_destroy(me);
}

Over 10 trials, the old array finished in 2.05 seconds while the new array finished in 1.99 seconds. This is 3% faster.

@bkthomps bkthomps added the efficiency Any improvement which can be made to the time or memory usage label Aug 7, 2020
@bkthomps bkthomps self-assigned this Aug 7, 2020
@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2020

Codecov Report

Merging #71 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #71   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines         2711      2710    -1     
=========================================
- Hits          2711      2710    -1     
Impacted Files Coverage Δ
src/array.c 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48b0751...89bc481. Read the comment docs.

@bkthomps
Copy link
Owner Author

bkthomps commented Aug 8, 2020

Need to check valgrind and update headers.

@bkthomps
Copy link
Owner Author

bkthomps commented Aug 8, 2020

No leaks on valgrind.

@bkthomps bkthomps merged commit fdde32d into master Aug 8, 2020
@bkthomps bkthomps deleted the rewrite-array branch August 8, 2020 23:05
This was referenced Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
efficiency Any improvement which can be made to the time or memory usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants