3 ms·
Just FYI, they ran this example over some built in reflection APIs. Hard to write code designed to get methods by string name without strings...
by jayd16 9y ago
Just FYI, they ran this example over some built in reflection APIs. Hard to write code designed to get methods by string name without strings...
- hinkley 9y agoExhibit A: The getLoadNames method returns a List of Strings, which we iterate over in order to see if a particular String value is in there. Even in describing the algorithm we aren't informed it's a list of function names. Edit: from the comments in the code it's pulling field names from a Mongo result set, so it's member variables more so than function names. One half of that relationship is still deterministic at runtime. Mongo records can change whenever but your ORM is dealing with Classes and their contents are known at runtime.
- s73ver_ 9y agoBecause for the purposes of example, it doesn't matter what the data actually is.
- hinkley 9y agoI'll bet you a six pack that hasName is called in a tight loop somewhere. The cost of generating the collection on every call is far greater than the cost of iterating it was. Can we at least agree that the chosen example has too many other confounding factors in it?