Tags: facebook/folly
Tags
opt in folly to uv2 Summary: looks like we need to opt in to modifiers certain packages so that adding folly to unified v2 doesn't break it. #buildall Reviewed By: rexzhang123, 8Keep Differential Revision: D109093010 fbshipit-source-id: d4c0f1b4ab265d9ee03e5e230252bd9d971b9899
Add toUpperAscii companion to toLowerAscii Summary: Adds `folly::toUpperAscii(char*, size_t)` plus `MutableStringPiece` and `std::string&` overloads, mirroring the existing `folly::toLowerAscii` API. Same branchless, alignment-aware 8/32/64-bit pipeline; the constants (+0x05 / +0x1a / -0x20) are retuned so that 'a'-'z' lands in the high-bit-set window after the input-rotating trick, with per-byte values small enough that the SIMD-packed forms don't carry across byte boundaries. High-bit input bytes pass through unchanged, matching the lower path's documented guarantee. Lets callers drop the `std::transform` + `std::toupper((unsigned char)c)` pattern -- Devmate flags it as locale-dependent because `<cctype>` consults the C locale -- and the bespoke `(c >= 'a' && c <= 'z') ? c - 0x20 : c` lambdas that appear in a handful of spots today. Also tightens `testToLowerAscii`, which was passing raw signed-char bytes >=0x80 to `std::tolower` (technically UB; passed only by accident under the C locale). Reviewed By: dmm-fb Differential Revision: D108289359 fbshipit-source-id: fb79fad5681e8dd89ad4a1951e0fbd2ebd5fb117
Revert D106566362: Fix -Wunsafe-buffer-usage errors in folly using sa… …fer C++ abstractions Differential Revision: D106566362 Original commit changeset: e03856898593 Original Phabricator Diff: D106566362 fbshipit-source-id: 3cbd5925eb83634c39ebae0e1ccd739cd08d7789
getdeps generate-github-actions: remove --recursive from build cmd Summary: The `build` subcommand already builds all transitive deps unconditionally (`manifests_in_dependency_order()` always returns the full dep graph). The `--recursive` flag added to `final_build_cmd` in D106028158 is not a recognized argument for `build`, so argparse exits non-zero and every GHA job fails before building anything. Fix: remove `--recursive` from the generated build step in `workflow_generator.py`. Regenerated all affected workflow files via `update-all-github-actions.sh` and updated test fixtures with `UPDATE_FIXTURES=1 buck run`. The `--recursive` flag remains correct on `install-system-deps` and `query-paths` steps, where it is a defined and meaningful argument. Supersedes D106119149. Reviewed By: bigfootjon Differential Revision: D106122539 fbshipit-source-id: f10dc25bee75b64171844d94cd35eec0f37e8445
Always store capacity in small_vector heap allocations Summary: Conditionally saving 8 bytes turns out to be quite expensive, see the `malloc_usable_size` explanation in the previous diff. This change proposes giving up on the 8 bytes in favour of avoiding the jemalloc cost. There are also other savings, aside from `malloc_usable_size`: * `capacity()` -> `arena_salloc` -> `emap_alloc_ctx_lookup` (i.e., on `emplace_back()`, checking capacity without heapified capacity is also costly) * `sizedFree()` in favour of `free()` * no more branching and checks Surgically setting the threshold to 0 for now to split from the cleanup and have the discussion here - see next diffs. Reviewed By: ot Differential Revision: D101653351 fbshipit-source-id: af45a9454efb39f2057e7df06408aedcd9000e6a
folly/json: micro-optimize serialization Printer hot path
Summary:
Eliminates repeated allocations and strlen calls in the json::Printer
serialization hot path:
- newline() no longer constructs two temporary std::string objects per
call; it appends directly to out_ via push_back('\n') and
append(count, ' ').
- mapColon() uses sized append(": ", 2) / push_back(':') instead of
operator+=(const char*) (which calls strlen at runtime).
- BOOL and NULLT cases use append("true"|"false"|"null", len) instead
of operator+=(const char*), avoiding strlen.
- Empty {} and [] literals in printObject/printArray use
append(literal, 2).
- DOUBLE case caches v.asDouble() once instead of calling it up to
three times (NaN check, Inf check, and toAppend).
- Single-char out_ += 'x' switched to explicit push_back('x') for
intent-clarity (semantically identical).
No behavior change: emitted JSON, error message wording, and exception
types are byte-identical. escapeStringImpl (already SIMD-optimized via
firstEscapableInWord) is untouched, so single-string serialize
benchmarks are flat; the wins come on object serialization.
Reviewed By: mofa28
Differential Revision: D103298577
fbshipit-source-id: 9da96c2c16c4a49f0f3e9e0dc93439b4745545a4
Teach MemoryMapping to size Android ashmem fds Summary: ### THIS DIFF Teach `folly::MemoryMapping` to size Android ashmem-backed file descriptors transparently by probing `ASharedMemory_getSize(fd)` before falling back to `fstat()`, and add coverage for that path. ### PLAN 1. Add legacy regular-file coverage. 2. Teach `folly::MemoryMapping` to size Android shared-memory fds transparently. 3. Migrate Codec Avatar back to `folly::MemoryMapping` and delete `SharedMemoryMapping`. ### CONTEXT Codec Avatar currently needs a custom Android-only mapping path because ashmem-backed render asset fds report an unusable size through the existing Folly path. This diff fixes that gap in Folly without adding a new caller-visible API and preserves the existing regular-file behavior when the ashmem probe does not apply. Differential Revision: D99928672 fbshipit-source-id: a86432e7c380983a053bdd1430bde2686960c651
PreviousNext