> ## Content Index
> Fetch the complete content index at: https://www.modernlearner.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# Using Facebook Infer Static Analysis for Loop Invariant Function Hoisting
- URL: https://www.modernlearner.org/facebook-infer-static-analysis-loop-invariant-video/
- Published: 2020-11-06T03:25:29.000Z
- Updated: 2024-04-09T22:39:18.000Z
- Description: Learn and watch a video about how Facebook Infer static analysis will detect loop invariants, with an example of how to correct this issue.
- Author: Modern Learner

We just released another short video for our free series on the Infer static analysis tool:

We cover an example that Facebook Infer would flag and warn you about. The idea is that you want a loop to be as efficient as possible and if you find a function that's being called repeatedly with the same result (a.k.a. an invariant), it can be safely hoisted outside of the loop.

You can read more about this at the Facebook Infer documentation site: [https://fbinfer.com/docs/all-issue-types#invariant\_call](https://fbinfer.com/docs/all-issue-types?ref=modernlearner.org#invariant%5Fcall)