Skip to content

Fix the inconsistent behavior between Spine vector's setSize and std::vector's resize, which causes the Spine vector to allocate additional space upfront.#18678

Merged
dumganhar merged 2 commits intococos:v3.8.7from
bofeng-song:387_spine_vector
Apr 28, 2025

Conversation

@bofeng-song
Copy link
Contributor

@bofeng-song bofeng-song commented Apr 28, 2025

Re: #
EsotericSoftware/spine-runtimes#2830

image
As shown in the screenshot, when the vector is empty, the first call to resize results in capacity and size being equal, meaning no additional capacity is allocated.

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

…:vector's resize, which causes the Spine vector to allocate additional space upfront.
@bofeng-song bofeng-song requested a review from dumganhar April 28, 2025 06:48
@bofeng-song
Copy link
Contributor Author

I've sent a PR to Spine

@bofeng-song bofeng-song reopened this Apr 28, 2025
@github-actions
Copy link

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1005779 bytes 1005779 bytes ✅ 0 bytes
2D All (legacy pipeline) 2669443 bytes 2669527 bytes ⚠️ +84 bytes
2D All (new pipeline) 2757950 bytes 2758034 bytes ⚠️ +84 bytes
(2D + 3D) All 10013834 bytes 10013918 bytes ⚠️ +84 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16921864 bytes 16829288 bytes 👍 -92576 bytes

Interface Check Report

This pull request does not change any public interfaces !

@dumganhar dumganhar merged commit 548aa0b into cocos:v3.8.7 Apr 28, 2025
39 of 67 checks passed
@bofeng-song bofeng-song deleted the 387_spine_vector branch May 19, 2025 09:18
AILHC pushed a commit to AILHC/cocos-engine that referenced this pull request Jun 11, 2025
…:vector's resize, which causes the Spine vector to allocate additional space upfront. (cocos#18678)

(cherry picked from commit 548aa0b)

# Conflicts:
#	native/external-config.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants