Carpet

Carpet

2M Downloads

[Scarpet RFC] Should `system_info()` without params return only a list of possible params instead of getting all info?

altrisi opened this issue ยท 0 comments

commented

system_info() has grown quite a bit since it's introduction, and functions inside have been getting more expensive.

At the moment running the entire system_info() can be relatively expensive depending on the environment, since it will generate a map with all of the system_info() available parameters mapped to the result of their operations.

Most of the time, you don't need to get the entirety of system_info in one go, so the obvious choice is to call system_info(requested), with a parameter. However, people may end up using system_info():requested for whatever reason, creating expensive calls. I'd assume mostly because of not knowing about the better alternative/the downsides, but whatever.

Therefore I'm suggesting replacing the return value of system_info() without parameters to a list of the possible parameters, without executing their responses.

Another option is removing the parameter-less response completely, since (IMO) it's unlikely you'll be checking that programmatically, and if you are running it to see the list yourself, you are better off just checking the docs, that will have more information.