Selected changesmerged Nov 15, 2026
perf: Reduce pn.cache per-call overheadPython · 350 + / 131 −
Introduces 22 new declarations in panel/io/cache.py.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
panel/io/cache.py ↗ · 2 files
@@ -662,91 +846,126 @@ def decorator(func: Callable[_P, _R]) -> _CachedFunc[Callable[_P, _R]]: with _hash_context(hash_funcs, approximate): closure_key = _closure_key(func) - fallback_fname = uuid.uuid4().hex+ # If the function is defined inside a bokeh/panel application it is+ # recreated for each session, therefore we cache by file, class and+ # qualified function name. Since that is shared by all functions a+ # factory generates we also key on the values the function closes+ # over, and on the settings so that two decorations of one function+ # with e.g. a different ttl or to_disk do not share a cache.+ func_name = func.__name__+ qualname = getattr(func, '__qualname__', func_name)+ module = sys.modules.get(func.__module__)+ fname = '__main__' if func.__module__ == '__main__' else getattr(module, '__file__', None)+ if fname is None:+ fname = uuid.uuid4().hex+ settings = (+ max_items, policy, ttl, to_disk, str(cache_path) if to_disk else None,+ per_session, approximate+ )+ # The usage counts and access times only serve eviction+ track_usage = max_items is not None+ lru_dict = track_usage and policy == 'lru' and not to_disk+ # The bucket and the time of its last ttl sweep per method owner and+ # session, since the bucket hash is otherwise fixed for the function+ buckets: dict[tuple, tuple[str, list[float]]] = {} lock = threading.RLock() - def hash_func(*args, **kwargs):+ def lookup(args, kwargs): # Handle param.depends method by adding parameters to arguments- func_name = func.__name__- is_method = (
server: refactor, add server_slot_sched, prompt running hashC++ · 692 + / 466 −
Introduces 8 new declarations in tools/server/server-slot-sched.cpp.
Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.
tools/server/server-slot-sched.cpp ↗ · 11 files
@@ -0,0 +1,417 @@+#include "server-slot-sched.h"++#include "common.h"+#include "llama.h"+#include "log.h"++#include <algorithm>++//+// server_prompt+//++server_prompt_reuse server_prompt::get_reuse(int32_t n_prefix, bool has_new_tokens, int32_t n_swa, llama_pos pos_min) const {+ server_prompt_reuse res;+ res.n_past = n_prefix;+ res.pos_next = tokens.pos_next(n_prefix);++ // the first evaluated token attends to the positions > pos_eval - n_swa, so a SWA state+ // starting at pos_eval - n_swa + 1 is enough, while a state without SWA must end before pos_eval+ const llama_pos pos_eval = res.pos_next - (has_new_tokens ? 0 : 1);++ // a state or a checkpoint is useful when its pos_min is below this threshold+ const auto pos_min_thold = std::max(0, n_swa > 0 ? pos_eval - n_swa + 2 : pos_eval);++ if (pos_min < pos_min_thold) {+ return res;+ }++ // search for a context checkpoint+ const auto it = std::find_if(+ checkpoints.rbegin(),+ checkpoints.rend(),+ [&](const auto & ckpt) {
src: write strings to streams without flatteningC++ · 48 + / 24 −
Introduces 2 new declarations in src/stream_base.cc.
Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.
src/stream_base.cc ↗ · 4 files
@@ -196,6 +197,38 @@ int StreamBase::FinishWrite(const v8::FunctionCallbackInfo<v8::Value>& args, return res.err; } +namespace {++// Same as StringBytes::Write(), but copies one-byte strings out with+// String::WriteOneByte(), which does not flatten them: strings written to a+// stream are often built by concatenation (e.g. HTTP headers) and not used+// again.+size_t WriteStringWithoutFlattening(Isolate* isolate,+ char* buf,+ size_t buflen,+ Local<String> string,+ enum encoding enc) {+ const size_t length = string->Length();+ if (length == 0) return 0;+ if (string->IsOneByte()) {+ if ((enc == ASCII || enc == LATIN1) && buflen >= length) {+ string->WriteOneByte(isolate, 0, length, reinterpret_cast<uint8_t*>(buf));+ return length;+ }+ if (enc == UTF8 && buflen >= 3 * length) {+ // Latin-1 takes at most 2 UTF-8 bytes per char: convert from the last+ // third into the first two.+ char* latin1 = buf + 2 * length;+ string->WriteOneByte(+ isolate, 0, length, reinterpret_cast<uint8_t*>(latin1));+ return simdutf::convert_latin1_to_utf8(latin1, length, buf);+ }+ }+ return StringBytes::Write(isolate, buf, buflen, string, enc);+}+
turbo-persistence: keep used keys across intermediate mergesRust · 165 + / 4 −
Introduces 3 new declarations in turbopack/crates/turbo-persistence/src/tests.rs.
Adds new framework internals rather than adjusting what was there. Read the linked PR for the surrounding test context.
turbopack/crates/turbo-persistence/src/tests.rs ↗ · 3 files
@@ -3192,6 +3192,138 @@ fn used_keys_live_as_long_as_the_meta_file_that_recorded_them(#[case] mmap: bool Ok(()) } +/// How [`used_keys_survive_intermediate_merges`] leaves the bottom merge of a shard for later.+#[cfg(not(miri))]+#[derive(Clone, Copy, Debug)]+enum PartialCompaction {+ /// One pass bottom merges one shard and intermediate merges the other.+ SamePass,+ /// One pass bottom merges one shard, a later one intermediate merges the other.+ BottomFirst,+ /// One pass intermediate merges one shard, while the meta file that recorded the used keys is+ /// kept alive by the other shard's files. A later pass bottom merges that other shard, which+ /// retires it.+ IntermediateFirst,+}++/// An intermediate merge can retire the meta file that recorded the used keys before every shard+/// had its bottom merge, e.g. when the rewrite quota or `max_merge_jobs` leaves a shard's bottom+/// merge for later. The used keys then have to live on in the meta file written by the compaction,+/// until the merged entries are bottom merged.+#[cfg(not(miri))]+#[rstest]+fn used_keys_survive_intermediate_merges(+ #[values(true, false)] mmap: bool,+ #[values(+ PartialCompaction::SamePass,+ PartialCompaction::BottomFirst,+ PartialCompaction::IntermediateFirst+ )]+ partial: PartialCompaction,+) -> Result<()> {+ let tempdir = tempfile::tempdir()?;
BUG: cut with nullable/pyarrow integers above 2**53 (GH#31389)Python · 45 + / 7 −
Introduces 1 new declaration in pandas/core/reshape/tile.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
pandas/core/reshape/tile.py ↗ · 3 files
@@ -572,6 +582,36 @@ def _bins_to_cuts( return result, bins +def _search_values(x_idx: Index, x_exact: Index, bins: Index) -> Index | np.ndarray:+ """+ Values to compare with ``bins``.++ ``x_idx`` holds nullable and pyarrow integers cast to float64, which loses+ precision above 2**53 (GH#31389). If the original integers fit the dtype of+ integer ``bins``, return them in that dtype instead, with NA filled with 0.+ """+ dtype = x_exact.dtype+ if not isinstance(dtype, (BaseMaskedDtype, ArrowDtype)) or not is_integer_dtype(+ dtype+ ):+ return x_idx++ bins_dtype = bins.dtype+ if isinstance(bins_dtype, IntervalDtype):+ bins_dtype = bins_dtype.subtype+ if isinstance(bins_dtype, (BaseMaskedDtype, ArrowDtype)):+ bins_dtype = bins_dtype.numpy_dtype+ if not lib.is_np_dtype(bins_dtype, "iu"):+ return x_idx++ values = x_exact.to_numpy(dtype=dtype.numpy_dtype, na_value=0)+ info = np.iinfo(bins_dtype)+ if len(values) and (values.min() < info.min or values.max() > info.max):+ # casting would overflow, keep the float64 values+ return x_idx+ return values.astype(bins_dtype, copy=False)++