openharmony_ci 82f0e8bcf7 !3 merge master into master
memchr新增bundle.json部件化

Created-by: dragonswordy
Commit-by: ljy9810
Merged-by: openharmony_ci
Description: ### 一、内容说明(相关的Issue)
https://gitcode.com/openharmony/third_party_rust_autocfg/issues/3


### 二、建议测试周期和提测地址  
  建议测试完成时间:xxxx.xx.xx  
  投产上线时间:xxxx.xx.xx  
  提测地址:CI环境/压测环境  
  测试账号:  

### 三、变更内容
  * 3.1 关联PR列表

  * 3.2 数据库和部署说明  
    1. 常规更新 
    2. 重启unicorn
    3. 重启sidekiq
    4. 迁移任务:是否有迁移任务,没有写 "无"
    5. rake脚本:`bundle exec xxx RAILS_ENV = production`;没有写 "无"

  * 3.4 其他技术优化内容(做了什么,变更了什么)
    - 重构了 xxxx 代码
    - xxxx 算法优化


  * 3.5 废弃通知(什么字段、方法弃用?)



  * 3.6  后向不兼容变更(是否有无法向后兼容的变更?)


  
### 四、研发自测点(自测哪些?冒烟用例全部自测?)
  自测测试结论:


### 五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)
  检查点:

| 需求名称 | 是否影响xx公共模块 | 是否需要xx功能 | 需求升级是否依赖其他子产品 |
|------|------------|----------|---------------|
| xxx  | 否          | 需要       | 不需要           |
|      |            |          |               |

  接口测试:

  性能测试:

  并发测试:

  其他:



See merge request: openharmony/third_party_rust_memchr!3
2025-12-31 22:06:21 +08:00
2022-04-30 13:28:46 -04:00
2018-09-17 16:31:52 -04:00
2020-01-22 20:32:55 -05:00
2025-12-24 09:40:49 +08:00
2021-12-22 13:59:57 -05:00
2025-12-24 09:40:49 +08:00
2022-04-30 13:29:26 -04:00
2015-06-11 19:00:02 -04:00
2015-06-11 19:00:02 -04:00
2023-04-14 14:15:05 +08:00
2022-04-30 13:28:46 -04:00
2020-01-10 18:59:01 -05:00
2015-06-11 19:00:02 -04:00

memchr

This library provides heavily optimized routines for string search primitives.

Build status Crates.io

Dual-licensed under MIT or the UNLICENSE.

Documentation

https://docs.rs/memchr

Overview

  • The top-level module provides routines for searching for 1, 2 or 3 bytes in the forward or reverse direction. When searching for more than one byte, positions are considered a match if the byte at that position matches any of the bytes.
  • The memmem sub-module provides forward and reverse substring search routines.

In all such cases, routines operate on &[u8] without regard to encoding. This is exactly what you want when searching either UTF-8 or arbitrary bytes.

Compiling without the standard library

memchr links to the standard library by default, but you can disable the std feature if you want to use it in a #![no_std] crate:

[dependencies]
memchr = { version = "2", default-features = false }

On x86 platforms, when the std feature is disabled, the SSE2 accelerated implementations will be used. When std is enabled, AVX accelerated implementations will be used if the CPU is determined to support it at runtime.

Using libc

memchr is a routine that is part of libc, although this crate does not use libc by default. Instead, it uses its own routines, which are either vectorized or generic fallback routines. In general, these should be competitive with what's in libc, although this has not been tested for all architectures. If using memchr from libc is desirable and a vectorized routine is not otherwise available in this crate, then enabling the libc feature will use libc's version of memchr.

The rest of the functions in this crate, e.g., memchr2 or memrchr3 and the substring search routines, will always use the implementations in this crate. One exception to this is memrchr, which is an extension in libc found on Linux. On Linux, memrchr is used in precisely the same scenario as memchr, as described above.

Minimum Rust version policy

This crate's minimum supported rustc version is 1.41.1.

The current policy is that the minimum Rust version required to use this crate can be increased in minor version updates. For example, if crate 1.0 requires Rust 1.20.0, then crate 1.0.z for all values of z will also require Rust 1.20.0 or newer. However, crate 1.y for y > 0 may require a newer minimum version of Rust.

In general, this crate will be conservative with respect to the minimum supported version of Rust.

Testing strategy

Given the complexity of the code in this crate, along with the pervasive use of unsafe, this crate has an extensive testing strategy. It combines multiple approaches:

  • Hand-written tests.
  • Exhaustive-style testing meant to exercise all possible branching and offset calculations.
  • Property based testing through quickcheck.
  • Fuzz testing through cargo fuzz.
  • A huge suite of benchmarks that are also run as tests. Benchmarks always confirm that the expected result occurs.

Improvements to the testing infrastructure are very welcome.

Algorithms used

At time of writing, this crate's implementation of substring search actually has a few different algorithms to choose from depending on the situation.

  • For very small haystacks, Rabin-Karp is used to reduce latency. Rabin-Karp has very small overhead and can often complete before other searchers have even been constructed.
  • For small needles, a variant of the "Generic SIMD" algorithm is used. Instead of using the first and last bytes, a heuristic is used to select bytes based on a background distribution of byte frequencies.
  • In all other cases, Two-Way is used. If possible, a prefilter based on the "Generic SIMD" algorithm linked above is used to find candidates quickly. A dynamic heuristic is used to detect if the prefilter is ineffective, and if so, disables it.
S
Description
提供在内存中搜索字符的支持。 | A Rust library that provides support for searching for characters in memory.
Readme 12 MiB
Languages
Rust 99.3%
Python 0.5%
Shell 0.2%