# What is the fastest way of making a vector of dictionaries?

**URL:** <https://discourse.julialang.org/t/what-is-the-fastest-way-of-making-a-vector-of-dictionaries/112363>\
**Category:** General Usage\
**Created:** [March 31, 2024, 11:53pm UTC](https://discourse.julialang.org/t/what-is-the-fastest-way-of-making-a-vector-of-dictionaries/112363 "2024-03-31T23:53:51Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 1, 2024, 2:59pm UTC](https://discourse.julialang.org/t/what-is-the-fastest-way-of-making-a-vector-of-dictionaries/112363/9 "2024-04-01T14:59:52Z")

</div>

> [@PetrKryslUCSD](#):
>
> seemed to indicate that I could get a speedup by using dictionaries, yet in actual application they are much slower than the original approach.

I’m not surprised — if allocating _empty_ dictionaries takes a significant fraction of your compute time, then you must do only a small number of subsequent operations per dictionary. For very small dictionaries being accessed a limited number of times it will be probably faster to use another data structure (even linear search).

(For performance optimizing dictionaries, one may also want to consider custom hash function — [Dictionary with custom hash function](https://discourse.julialang.org/t/dictionary-with-custom-hash-function/49168))

---

_[View the full topic](https://discourse.julialang.org/t/what-is-the-fastest-way-of-making-a-vector-of-dictionaries/112363)._
