What are the performance implications for GetAttribute() vs FindFirstChild()

Now we all know that FindFirstChild is incredibly sluggish, especially in loop bound scenarios; but I’m wondering if anybody has metric data on the comparrison for nil validation between the two.

Is there an improvement in using GetAttribute to identify if a value exists rather than making an actual instance of the value than using FindFirstChild?

I’ve personally been using GetAttribute and SetAttribute alot in my code and have come to an assumption that it is either the same speed or slightly faster due to being more internal using status values.

Interesting to see if anybody who does performance testing could clear this up, or if anybody already has data on this! :slightly_smiling_face:

3 Likes

Bump.

I’d be interested to know this too.

1 Like

GetAttribute() is faster than FindFirstChild()

Hey!
I finally have an answer to this question.

It turns out my theory was indeed correct, GetAttribute() in terms of relative performance difference is very minimalistic - unless you’re relying on performance heavy code; if you are relying on performance heavy code; you would greatly benefit from using Attributes instead.

I used the benchmarking plugin by @boatbomber for these tests.

In this test, the code was ran 10,000 times for good measure. You can see a 0.3ms difference.

6 Likes