09/01/2026
🤠 There was no existing priority queue implementation for ObjectScript, so someone built one — and then benchmarked four different approaches against each other using Dijkstra's shortest path algorithm on a 150,000-vertex graph.
The surprising finding: the best approach is not a binary heap at all. It is using the fact that multidimensional arrays in ObjectScript are always sorted. You store your data as data(evaluation, obj_str_rep) = object and use $Order to get the minimum element. No heap logic needed.
The numbers: self-sorting multidimensional finished in 45 seconds. The binary heap on multidimensional took 381 seconds. The %DynamicArray-based heap took 3,466 seconds — and its time per batch kept growing as the queue got bigger 😄
The article includes complete ObjectScript code for both the binary heap and the self-sorting implementation, so you can drop either one into your own projects.
Read the full article 👇
https://community.intersystems.com/post/best-structure-make-priority-queue-objectscript