Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3.8.6] Optimize code size again. #18197

Merged
merged 3 commits into from
Jan 17, 2025

Conversation

dumganhar
Copy link
Contributor

Re: #18056

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.

@dumganhar dumganhar requested review from minggo and star-e January 15, 2025 10:28
@@ -474,7 +474,7 @@ export class Material extends Asset {
protected _uploadProperty (pass: Pass, name: string, val: MaterialPropertyFull | MaterialPropertyFull[]): boolean {
const handle = pass.getHandle(name);
if (!handle) { return false; }
const type = Pass.getTypeFromHandle(handle);
const type = getTypeFromHandle(handle);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The static method Pass.getTypeFromHandle could not be optimized by terser but getTypeFromHandle could.

Copy link

github-actions bot commented Jan 15, 2025

👍 Package size ⤵ -1477 bytes, old: 5241693, new: 5240216

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -1137,32 +1137,10 @@
          */
         ensureMeshData(): void;
         destroy(): boolean;
         /**
-         * Calculate UV for sliced
          * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
          */
-        _calculateSlicedUV(): void;
-        /**
-         * Calculate UV
-         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-         */
-        _calculateUV(): void;
-        /**
-         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-         */
-        _setDynamicAtlasFrame(frame: any): void;
-        /**
-         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-         */
-        _resetDynamicAtlasFrame(): void;
-        /**
-         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-         */
-        _checkPackable(): void;
-        /**
-         * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-         */
         _serialize(ctxForExporting: any): any;
         /**
          * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
          */
@@ -11191,9 +11169,9 @@
                 /**
                  * Editor specific gizmo camera logic
                  * @internal
                  */
-                syncCameraEditor(camera: any): void;
+                syncCameraEditor(camera: Camera): void;
                 /**
                  * @en Update the camera's builtin matrixes
                  * @zh 更新相机的视图、投影等矩阵
                  * @param forceUpdate If force update, then dirty flag will be ignored

@@ -23,16 +23,18 @@
THE SOFTWARE.
*/

import { BYTEDANCE, WECHAT, WECHAT_MINI_PROGRAM } from 'internal:constants';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems these constants are not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved it from bellow lines. It's better to put constants at the beginning.
And they are used in this file, see

if (WECHAT || WECHAT_MINI_PROGRAM || BYTEDANCE) {
                    this.__isWebIOS14OrIPadOS14Env = (sys.os === OS.IOS || sys.os === OS.OSX) && GameGlobal?.isIOSHighPerformanceMode
            && /(OS 1((4\.[0-9])|(5\.[0-3])))|(Version\/1((4\.[0-9])|(5\.[0-3])))/.test(window.navigator.userAgent);
                } else {
                    this.__isWebIOS14OrIPadOS14Env = (sys.os === OS.IOS || sys.os === OS.OSX) && systemInfo.isBrowser
            && /(OS 14)|(Version\/14)/.test(window.navigator.userAgent);
                }

@minggo minggo merged commit 1d870a7 into cocos:v3.8.6 Jan 17, 2025
12 checks passed
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.

3 participants