# Support priority queue!

**URL:** <https://es.discourse.group/t/support-priority-queue/1223>\
**Category:** 💡 Ideas\
**Tags:** proposal\
**Created:** [February 23, 2022, 7:36am UTC](https://es.discourse.group/t/support-priority-queue/1223 "2022-02-23T07:36:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttttttssssss](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/ttttttssssss/32/1256_2.png) [@ttttttssssss](https://es.discourse.group/u/ttttttssssss)\
**Post date:** [February 23, 2022, 7:36am UTC](https://es.discourse.group/t/support-priority-queue/1223/1 "2022-02-23T07:36:28Z")

</div>

For now, `JavaScript` does not support any `data structure`. If developers want to use `data structure`, they can only rely on community (eg. `github`). This is very bad.

The reasons are as follows:

1. The `data structure` belongs to the basic function and has a wide range of application scenarios. It needs the support of the engine (eg. `V8`) to make it play faster, rather than using `js` to write it.

2. Most developers will only choose the library by `github star` and have no time to see whether its implementation is correct and **efficient**.

I think we should gradually improve the proposal in this regard. His importance doesn't even need my explanation.

Let's start with the priority queue !!! Of course, the more `data structure` supported, the better.

---

<div class="post-metadata">

**Author:** ![aclaymore](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aclaymore/32/501_2.png) [@aclaymore](https://es.discourse.group/u/aclaymore)\
**Post date:** [February 23, 2022, 11:14am UTC](https://es.discourse.group/t/support-priority-queue/1223/2 "2022-02-23T11:14:24Z")

</div>

Hi @ttttttssssss

Were you imagining something similar to [heap - npm](https://www.npmjs.com/package/heap) ? Which is inspired by Python's [heapq](https://docs.python.org/3/library/heapq.html).

---

<div class="post-metadata">

**Author:** ![ttttttssssss](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/ttttttssssss/32/1256_2.png) [@ttttttssssss](https://es.discourse.group/u/ttttttssssss)\
**Post date:** [February 23, 2022, 11:20am UTC](https://es.discourse.group/t/support-priority-queue/1223/3 "2022-02-23T11:20:42Z")

</div>

Yes. `Heap` and `Priority Queue` are one thing in principle.

---

<div class="post-metadata">

**Author:** ![ttttttssssss](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/ttttttssssss/32/1256_2.png) [@ttttttssssss](https://es.discourse.group/u/ttttttssssss)\
**Post date:** [February 24, 2022, 7:02am UTC](https://es.discourse.group/t/support-priority-queue/1223/5 "2022-02-24T07:02:16Z")

</div>

So what do you think of the `priority queue`(`heap`) as a proposal?

I'm curious that no one commented on my posts. Is it because it's not attractive enough?

As far as I know, `Java`, `Python`, `C++`, `Go` are all supported, but `JS` gives it to the community library.

---

<div class="post-metadata">

**Author:** ![ljharb](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/ljharb/32/8_2.png) [@ljharb](https://es.discourse.group/u/ljharb)\
**Post date:** [February 24, 2022, 2:56pm UTC](https://es.discourse.group/t/support-priority-queue/1223/6 "2022-02-24T14:56:54Z")

</div>

What are the use cases for it? What would an engine be able to do that a userland implementation couldn’t?

---

<div class="post-metadata">

**Author:** ![ipreencekmr](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/ipreencekmr/32/2750_2.png) [@ipreencekmr](https://es.discourse.group/u/ipreencekmr)\
**Post date:** [October 21, 2026, 4:20pm UTC](https://es.discourse.group/t/support-priority-queue/1223/7 "2026-10-21T16:20:40Z")

</div>

If python, java and c++ has built-in priority queue then why can't we have it with JavaScript ?
