mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Add lru_cache for get_shader_code_from_file
This commit is contained in:
parent
7895a2cfee
commit
dddaef0e6c
1 changed files with 3 additions and 1 deletions
|
@ -7,6 +7,8 @@ import re
|
||||||
import moderngl
|
import moderngl
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
from functools import lru_cache
|
||||||
|
|
||||||
from manimlib.utils.directories import get_shader_dir
|
from manimlib.utils.directories import get_shader_dir
|
||||||
from manimlib.utils.file_ops import find_file
|
from manimlib.utils.file_ops import find_file
|
||||||
from manimlib.utils.iterables import resize_array
|
from manimlib.utils.iterables import resize_array
|
||||||
|
@ -159,7 +161,7 @@ class ShaderWrapper(object):
|
||||||
# For caching
|
# For caching
|
||||||
filename_to_code_map: dict[str, str] = {}
|
filename_to_code_map: dict[str, str] = {}
|
||||||
|
|
||||||
|
@lru_cache(maxsize=12)
|
||||||
def get_shader_code_from_file(filename: str) -> str | None:
|
def get_shader_code_from_file(filename: str) -> str | None:
|
||||||
if not filename:
|
if not filename:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Reference in a new issue