langchain-ai
langchain
BlogDocsChangelog

perf(core): precompile hex color regex pattern at module level

#34480
Comparing
Rudra-Tiwari-codes:perf/precompile-hex-color-regex
(
f083369
) with
master
(
75b07b3
)
CodSpeed Performance Gauge
+7%
Untouched
13
Skipped
21

Benchmarks

Skipped (21)

Passed

test_import_time[RunnableLambda]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+10%
540.6 ms491.9 ms
test_import_time[Runnable]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+9%
533.9 ms487.7 ms
test_import_time[PydanticOutputParser]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+9%
582.7 ms532.9 ms
test_import_time[LangChainTracer]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+9%
480 ms439 ms
test_import_time[BaseChatModel]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+9%
574.2 ms526 ms
test_import_time[ChatPromptTemplate]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+8%
646.1 ms598.1 ms
test_import_time[InMemoryVectorStore]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+7%
660.5 ms616 ms
test_import_time[InMemoryRateLimiter]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+7%
186 ms174.2 ms
test_import_time[tool]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+6%
555.8 ms524 ms
test_import_time[Document]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+5%
196.2 ms187 ms
test_import_time[CallbackManager]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+4%
482 ms463.3 ms
test_async_callbacks_in_sync
libs/core/tests/benchmarks/test_async_callbacks.py
CodSpeed Performance Gauge
+2%
24.4 ms24 ms
test_import_time[HumanMessage]
libs/core/tests/benchmarks/test_imports.py
CodSpeed Performance Gauge
+1%
273.9 ms272.5 ms

Commits

Click on a commit to change the comparison range
Base
master
75b07b3
+6.6%
perf(core): precompile hex color regex pattern at module level Move _HEX_COLOR_PATTERN regex compilation from inside _render_mermaid_using_api() to module level. This avoids recompiling the regex on every function call, improving performance when rendering multiple Mermaid graphs. Also combined nested if statements per SIM102 lint rule.
f083369
18 hours ago
by Rudra-Tiwari-codes
© 2025 CodSpeed Technology
Home Terms Privacy Docs