定制 mortimer333/wobblefump 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mortimer333/wobblefump

Composer 安装命令:

composer require mortimer333/wobblefump

包简介

Symfony command to calculate binary difference between two files and transform the result using Fourier

README 文档

README

Symfony command to calculate binary difference between two files and transform the result using Fourier. It was build with large files in mind and keeping a low volatile memory usage. The default setting are capping the actual command usage to about 8MB (although it might lower sometimes), but it might appear higher due to Symfony internal operations (like 10-30MB higher).

After running the command you will receive detailed output about the actual memory usage and current progress. This command will run a long time (comparing two 7GB .safetensors takes about 6-7h) and will produce a file about twice the size of smallest given file (with two files of 7GB it created a ~14GB frequency spectrum).

Install

composer require mortimer333/wobblefump

and if you use symfony/flex it should be it! If not you might want to update bundles.yaml file:

<?php

return [
    // ...
    Mortimer333\Wobblefump\WobblefumpBundle::class => ['all' => true],
];

No you should be able to see new command being available wobblefump:diff:fourier.

Usage

# Both files locally
php bin/console wobblefump:diff:fourier ./file_big_v1.bin ./file_big_v2.bin
# Both files on the remote
php bin/console wobblefump:diff:fourier -mB https://cdn.com/file_big_v1 https://cdn.com/file_big_v2
# Only original file is on the remote
php bin/console wobblefump:diff:fourier -mO https://cdn.com/file_big_v1 ./file_big_v2.bin
# Just new file is on the remote
php bin/console wobblefump:diff:fourier -mN ./file_big_v1.bin https://cdn.com/file_big_v2

Advance usage:

php bin/console wobblefump:diff:fourier -h                                  
Description:
  Transform binary difference between two files using Fourier

Usage:
  wobblefump:diff:fourier [options] [--] <original> <new>

Arguments:
  original                   Path to the original file
  new                        Path to the new file

Options:
  -t, --test-run             Do a test-run (it will cap operations to the 10 chunks)
  -p, --precision=PRECISION  Precision of comparison (int) should be - size of chunks (1 is per one byte; 100 is per 100 bytes).
                             Precision will be rounded down to chunk size and it must be a power of 2. [default: 2048]
  -c, --chunk=CHUNK          The size of chunks (int) to be retrieved from the files. In terms of memory remember to multiply this value twice as it will be per each file. [default: 1048576]
  -o, --output=OUTPUT        Output path for the result [default: "./result.csv"]
  -D, --diff-file=DIFF-FILE  Output path for the difference output. If provided, the diff file will not be removed automatically [default: false]
  -m, --mode[=MODE]          How program should handle the file paths.
                             Modes:
                             O - only original is URL,
                             N - only new is URL,
                             B - both are URL,
                             F - none
                              [default: "F"]
  -h, --help                 Display help for the given command. When no command is given display help for the list command
  -q, --quiet                Do not output any message
  -V, --version              Display this application version
      --ansi|--no-ansi       Force (or disable --no-ansi) ANSI output
  -n, --no-interaction       Do not ask any interactive question
  -e, --env=ENV              The Environment name. [default: "dev"]
      --no-debug             Switch off debug mode.
      --profile              Enables profiling (requires debug).
  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Example output:

[MEMORY] Starting peak memory usage 44.5MB
Starting Find Diff script...
Script will operate in Dry mode - it will only try up to load 10 chunks
Loading and comparing files...
 6617/6617 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%          36 secs/36 secs          44.5 MiB/48.5 MiB
Diff file has 60 MB
Calculating Fourier Transform on the results...
 30721/30721 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%  3 mins, 20 secs/3 mins, 20 secs  50.5 MiB/48.5 MiB
Command finished successfully and the result was saved into /media/HDD/result.csv
Command took 237.63438200951 seconds to complete
[MEMORY] If memory usage didn't change drastically (like 1MB or 2MB) it will not detect the change:
[MEMORY] End peak memory usage 50.5MB
[MEMORY] Actual peak memory usage for the command: 6MB

mortimer333/wobblefump 适用场景与选型建议

mortimer333/wobblefump 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 11 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 mortimer333/wobblefump 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mortimer333/wobblefump 我们能提供哪些服务?
定制开发 / 二次开发

基于 mortimer333/wobblefump 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-only
  • 更新时间: 2024-11-23