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

Lua code not compressed in 1.5.0 #7899

Closed
d954mas opened this issue Aug 18, 2023 · 1 comment · Fixed by #7912
Closed

Lua code not compressed in 1.5.0 #7899

d954mas opened this issue Aug 18, 2023 · 1 comment · Fixed by #7912
Labels
bob Issues related to the bob command line build tool bug Something is not working as expected lua Issues related to the use of Lua pipeline Issue related to the asset build pipeline

Comments

@d954mas
Copy link
Contributor

d954mas commented Aug 18, 2023

Describe the bug (REQUIRED)
Lua code not compressed in 1.5.0 Beta

To Reproduce (REQUIRED)

  1. Build with bob
java -jar bob/bob.jar --settings bob/settings/dev_game.project_settings --archive  --texture-compression true --with-symbols --variant debug --platform=js-web --bo bob/releases/dev/web -brhtml bob/releases/dev/web/report.html clean resolve build bundle 

Expected behavior (REQUIRED)
Lua code compressed

Defold version (REQUIRED):

Platforms (REQUIRED):

  • Platforms: [Web]

Screenshots (OPTIONAL):
1.4.8
2023-08-18_20-21-18
1.5.0
2023-08-18_20-22-57

Additional context (OPTIONAL):
Add any other context about the problem here.

@d954mas d954mas added the bug Something is not working as expected label Aug 18, 2023
@AGulev
Copy link
Contributor

AGulev commented Aug 19, 2023

We changed the order of encryption and compression

int resourceEntryFlags = 0;
// Encrypt data first, so we can decrypt in place at runtime
// this allows us to minimize allocations/copying
if (entry.isEncrypted()) {
buffer = this.encryptResourceData(buffer);
resourceEntryFlags |= ResourceEntryFlag.ENCRYPTED.getNumber();
}
if (entry.isCompressed()) {
// Compress data
byte[] compressed = this.compressResourceData(buffer);
if (this.shouldUseCompressedResourceData(buffer, compressed)) {
// Note, when forced, the compressed size may be larger than the original size (For unit tests)
buffer = compressed;
entry.setCompressedSize(compressed.length);
entry.setFlag(ArchiveEntry.FLAG_COMPRESSED);
resourceEntryFlags |= ResourceEntryFlag.COMPRESSED.getNumber();
} else {
entry.setCompressedSize(ArchiveEntry.FLAG_UNCOMPRESSED);
}
}

and it seems like compression after encryption is extremely inefficient, I made some measurements:

Uncompressed and unencrypted:3893
Compressed, before encryption:2393
Encrypted, before compression:3893
Encrypted, after compression:2393
Compressed, after encryption:3910

@britzl britzl added bob Issues related to the bob command line build tool lua Issues related to the use of Lua pipeline Issue related to the asset build pipeline labels Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bob Issues related to the bob command line build tool bug Something is not working as expected lua Issues related to the use of Lua pipeline Issue related to the asset build pipeline
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants