Replies: 2 comments 2 replies
-
Right now the recommended approach is to perform these common calculations outside of the accessors, see https://deck.gl/docs/developer-guide/performance#use-trivial-functions-as-accessors |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks @Pessimistress , I was aware of that. My issue is that I'm working with the MVT layer so I am not aware of any way to preprocess the data to optimize the accessors unless I do that at the source which unfortunately is not an option. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone!
I have been trying to optimize my map rendering and thought about something that I'm not aware it can be done now, but I think would be useful.
TLDR: Sometimes many layer properties depend on some feature properties and we are executing the same logic once per each accessor.
Take for example this layer definition:
Suppose that
getPolygonColor
,getLineColor
andgetLineWidth
all need to evaluate something on the feature to decide those values. Suppose that we have 5 different sets of fill color, line color and line widths. Now also suppose that evaluation is expensive i.e. we need to perform a sqrt and some other math operations on some feature property to find which set of fill color, line color and line width to use.Separating the fill color, line color and line width accessors we need to perform that expensive evaluation three times. If we had something like the following, we could do it just once, improving performance a lot:
I know the complex evaluation could be done directly on the data before rendering it but it's just an example so please bear with me. What do you think? Is something like this possible with deck.gl? Would it be useful?
Sorry if something similar has already been proposed or exists but I haven't found anything neither in the documentation nor in the discussions/issues.
Beta Was this translation helpful? Give feedback.
All reactions