You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This functionality was lacking when I was implementing order book service (https://docs.kraken.com/websockets/#message-book) through SortedMap. When the maximum stored length is reached and a new level comes we want to pop the last element.
This could of course be implemented through map.delete(map.entries()[0][0]) but a call to entries would run a loop over each item in the map which is ineffective.
Currently I've implemented pop through map.store.pop(); map.length = map.store.length which uses the internals but does the job. Maybe there already is a cleaner way?
The text was updated successfully, but these errors were encountered:
This functionality was lacking when I was implementing order book service (https://docs.kraken.com/websockets/#message-book) through SortedMap. When the maximum stored length is reached and a new level comes we want to
pop
the last element.This could of course be implemented through
map.delete(map.entries()[0][0])
but a call toentries
would run a loop over each item in the map which is ineffective.Currently I've implemented
pop
throughmap.store.pop(); map.length = map.store.length
which uses the internals but does the job. Maybe there already is a cleaner way?The text was updated successfully, but these errors were encountered: