Re: [sensors] Don't allocate response objects to avoid triggering GC

> Could we instead provide a method that will fill sensor reading 
data, e.g. Sensor.getReading(Dictionary out); or 
Sensor.read(Dictionary out);? This will allow to reuse object, yet, 
main interface is not polluted with unwanted fields and extensibility 
is not lost.

This will require extra function call by a developer every time he 
wants to get some data out of a sensor? And it requires preparation - 
need to create object to store readings.
Haven't seen such pattern anywhere in a W3C.

Additionally, it is not necessary all readings data is required by 
developer, he might want to store only some of it. So clearly there 
will be overhead when all of it is not needed.

Direct access by either `sensor.x` or `sensor.data.x` - provides 
ability to store data developer wants, and access to the data without 
a need to call a function and no need for any advance preparations.
Plus this avoids any allocations.

-- 
GitHub Notification of comment by Maksims
Please view or discuss this issue at 
https://github.com/w3c/sensors/issues/153#issuecomment-267665668 using
 your GitHub account

Received on Friday, 16 December 2016 18:41:58 UTC