@Gordon, a non-pressing question about line 14 var i = this._keys.indexOf(k); of your Map implementation. I assume it handles the == conforming to the k(ey) type. So behavior is dependent on key nature. I assume any enhancements with, for example, hashing, would become an overkill, since the Maps can anyway not be really big, where it could matter. Furthermore, I like that it is a insert-sequence sorted Map, and so will be an iterator over keys and values (when exposed). A key sorted map would expect all key types - that means - all 'objects' ever to be used as keys would have to 'share' a comparator. For my needs so far, I never had to issue to come up with an id of a String and used the obvious not so 'loved' feature of the Object {} to handle my access (CRU). Since you know the ins and outs of your object property access, how does it compare with this map setup w/ key and value arrays?
I'm sure it is much more light weight than using the Promise machinery to get to the result... since in the code I see no asynchronous needs...
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@Gordon, a non-pressing question about line 14
var i = this._keys.indexOf(k);
of yourMap
implementation. I assume it handles the==
conforming to the k(ey) type. So behavior is dependent on key nature. I assume any enhancements with, for example, hashing, would become an overkill, since the Maps can anyway not be really big, where it could matter. Furthermore, I like that it is a insert-sequence sorted Map, and so will be an iterator over keys and values (when exposed). A key sorted map would expect all key types - that means - all 'objects' ever to be used as keys would have to 'share' a comparator. For my needs so far, I never had to issue to come up with an id of a String and used the obvious not so 'loved' feature of the Object{}
to handle my access (CRU). Since you know the ins and outs of your object property access, how does it compare with this map setup w/ key and value arrays?I'm sure it is much more light weight than using the Promise machinery to get to the result... since in the code I see no asynchronous needs...