Hacker News new | ask | show | jobs
by SJMG 116 days ago
Andreas is simultaneously brilliant and myopic to needs outside of his own (compiler dev).

It's amazing how many fights he gets into with Status-IM engineers who are the biggest financial supporters of the project and the only noteworthy company that heavily uses Nim.

Has OrderedTable been ported to Nimony? Does it still have this bug?

1 comments

OrderedTable in Nim appears to be the same and still have O(n) performance. On a delete, an entirely new table is constructed.

https://github.com/nim-lang/Nim/blob/devel/lib/pure/collecti...

I didn't know about Nimony and just took a look.

https://github.com/nim-lang/nimony/blob/master/lib/std/table...

OrderedTable is now a synonym for Table, ie, both are ordered. To delete a key, the key is looked up to get an index position x in a Seq, the Seq entries after x are shifted left, the Seq is trimmed of the last element, and then the entire table is rehashed because shifting the Seq invalidates the previous hash codes. The performance is better than Nim OrderedTables because at least an entirely new table isn't created, and it probably works fine for small tables, but it still isn't O(1). The performance would be similar to removing an item from a single-threaded sorted list: most painful to remove the 1st element, least painful to remove the last element, but then you still have to rehash the entire table.