Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/BuzzCutNorman/sdk into 1046…
Browse files Browse the repository at this point in the history
…-feat-faster-json-dumps-with-msgspec
  • Loading branch information
BuzzCutNorman committed Jan 29, 2024
2 parents 60e591e + 6844477 commit 2f7d05b
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 81 deletions.
101 changes: 40 additions & 61 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ inflection = ">=0.5.1"
joblib = ">=1.0.1"
jsonpath-ng = ">=1.5.3"
jsonschema = ">=4.16.0"
memoization = { version = ">=0.3.2,<0.5.0", python = "<4" }
msgspec = ">=0.18,<0.19"
packaging = ">=23.1"
pendulum = ">=2.1.0,<4"
Expand Down
10 changes: 5 additions & 5 deletions singer_sdk/helpers/_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
import typing as t
from copy import deepcopy

from memoization import cached

from singer_sdk.helpers._typing import is_object_type

if t.TYPE_CHECKING:
from singer_sdk._singerlib import Catalog, SelectionMask

_MAX_LRU_CACHE = 500


@cached(max_size=_MAX_LRU_CACHE)
# TODO: this was previously cached using the `memoization` library. However, the
# `functools.lru_cache` decorator does not support non-hashable arguments.
# It is possible that this function is not a bottleneck, but if it is, we should
# consider implementing a custom LRU cache decorator that supports non-hashable
# arguments.
def get_selected_schema(
stream_name: str,
schema: dict,
Expand Down
4 changes: 2 additions & 2 deletions singer_sdk/helpers/jsonpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import logging
import typing as t
from functools import lru_cache

import memoization
from jsonpath_ng.ext import parse

if t.TYPE_CHECKING:
Expand Down Expand Up @@ -39,7 +39,7 @@ def extract_jsonpath(
yield match.value


@memoization.cached
@lru_cache
def _compile_jsonpath(expression: str) -> jsonpath_ng.JSONPath:
"""Parse a JSONPath expression and cache the result.
Expand Down
Loading

0 comments on commit 2f7d05b

Please sign in to comment.