Knott: I don’t think they can really be polyfilled :/
Theobald: I mean, you can definitely create a constructor Map having the same “interface”.
Clakley: But I don’t know if you can make it have the same algorithmic complexity
Vafiadis: They can. there are just going to be losses in lookup speed capabilities for non-string objects unless you want to break spec and mutate the originals with a fake symbol
Vafiadis: BUT string-keyed Maps will be just as fast as a regular Map
Paulhus: Dictionary like key value pairds would be an object. but you could use a cachedb for this. like mongodb
Paulhus: Especially if you need it to be fast
Kerby: I am trying to save bandwidth, and I also have an eye towards running well on mobile.
Elvis: Writing to a database is going to be slower than an in memory lookup most of the time.
Paulhus: You can have a memory db
Vafiadis: Jonez: you can use an object for that, you just have to keep in mind possibly conflicts with Object’s prototype functions – IE there’s a possible vector for conflicts if there’s a chance a key could end up being, say, ‘hasOwnProperty’
Elvis: I’d be skeptical of getting good performance out of it unless it was explicitly designed for that.
Paulhus: I think they use some indexes and stuff for fast queries
Vafiadis: Var o = {}; o’hasOwnProperty’
Mate: Vafiadis: function hasOwnProperty
Vafiadis: Var d = Object.createnull; o’hasOwnProperty’
Mate: Vafiadis: ReferenceError: o is not defined
Vafiadis: Var d = Object.createnull; d’hasOwnProperty’
Elvis: Well thats probably a bug somewhere.
Vafiadis: Nah, it’s because “in” will count prototypically-inherited properties
Elvis: No i mean, in my code
Elvis: Probably nowhere it will actually get hit
Vafiadis: Anyway, Object.createnull has pretty good perf IIRC
Vafiadis: You’ll just lose perf if you want to call an object method on it via Object.prototype.foo.calldict
Elvis: Because i tend not to use that for truly dynamic stuff, but still. didn’t realize in looked up the prototype chain
Thach: Paulhus: an in-memory database still needs to deal with data serialisation/parsing.
Thach: Unless you just mean using Map, in which case, I’m not sure you can really call it an “in-memory database”
Vafiadis: Tcsc: yeah that’s where .hasOwnProperty comes in handy
Vafiadis: Granted it isn’t syntax, which may or may not be what you want
Elvis: Yeah i’ll keep that in mind in the future.
Elvis: I dont care about it being syntax or not.
Vafiadis: ES6 also has Reflect.hasOwnProperty
Elvis: What’s the difference?
Paulhus: Well. okay. i was kinda sure db’s use some sophisticated algorithms to query large data amounts. ptimizations for sorting, indexing etc.
Paulhus: Maybe it’s faster when u have just key value pairs without hierarchy
Vafiadis: Tcsc: err sorry, I mean Reflect.has
Vafiadis: Tcsc: which is actually more like “in” in that it will walk the prototype chain
Elvis: Paulhus: theres the overhead of sending it to the database, as well as the overhead of those algorithms themselves which tend to make it up mainly when used with a ton of data
Paulhus: Right. just forget what i was saying 0:-
Paulhus: I manouverd myself into sth i really did not want
Vafiadis: But Reflect DOES have a lot of the Object.foo methods on it – the benefit to most of them being that if the object doesn’t exist, it won’t throw but will instead return something usable
Vafiadis: Er, not necessarily if the object doesn’t exist but in situations where an error would throw
Elvis: The Object.prototype ones
Vafiadis: B var o = {a:1, b:2}; Object.freezeo; Reflect.seto, ‘a’, ‘new value’