F
Flow8mo ago
Giovanni S

Giovanni S | Flow (2024-04-05)

How computationally expensive is calling someArray.length - does it require enumeration over the entire array or is it constant time?
7 Replies
Needle
Needle8mo ago
I've created a thread for your message. Please continue any relevant discussion in this thread. You can rename this thread using /title <new title> If this is a technical question that others may benefit from, considering also asking it on Stackoverflow: https://stackoverflow.com/questions/ask?tags=onflow-cadence
turbolent
turbolent8mo ago
It's constant time, it's cheap
Giovanni S
Giovanni SOP8mo ago
Is that also the case for dictionaries? I thought there were previously concerns about computation required to get someMapping.length
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Giovanni S
Giovanni SOP8mo ago
Amazing, thank you. I'll need to play around with it
turbolent
turbolent8mo ago
No, AFAIK the length is stored in the root. cc @Faye | Flow
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server