### Summary

`ansible.template.is_template` tries to loop until it determines if the value is indeed a template.  Which means we could loop extremely large strings, that don't even remotely look like templates, before we bail.

However, we could benefit from moving `Templar.is_possibly_template` to the global scope, and testing whether the value after `jinja_env.preprocess` is even possibly a template, before doing more computationally complex validation.

### Issue Type

Feature Idea

### Component Name

lib/ansible/template/__init__.py

### Additional Information

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)

```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
convert_data=True, static_vars=None, cache=True, disable_lookups=False):
        '''
        Templates (possibly recursively) any given data as input. If convert_bare is
        set to True, the given data will be wrapped as a jinja2 variable ('{{foo}}')
        before being sent through the template engine.
        '''
        static_vars = [] if static_vars is None else static_vars
        
        if hasattr(variable, '__UNSAFE__'):
            return variable
        if fail_on_undefined is None:
            fail_on_undefined = self._fail_on_undefined_errors
        if convert_bare:
            variable = self._convert_bare_variable(variable)
        if isinstance(variable, string_types):
            if not self.is_possibly_template(variable):
                return variable
            
            
            
            only_one = self.SINGLE_VAR.match(variable)