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

Execute file size is too big, can sonic be optimized when compile? #574

Open
rts-gordon opened this issue Jan 17, 2024 · 9 comments
Open
Labels
enhancement New feature or request help wanted Extra attention is needed known-issue This issue is known to us, we are working on it

Comments

@rts-gordon
Copy link

Hi there,
Sonic is a great json library, high performance and very easy to use, thanks for your work.

But the execute file size is double, it is can‘t acceptable in my scenario. Can sonic be optimized when compile? for example: only compile source code for CPU/OS arch currently in use, maybe this will reduce execute file size.

Thank you.

image

@AsterDY
Copy link
Collaborator

AsterDY commented Jan 17, 2024

Ok, I will try it. First investigate where the binary comes from. If you already have stats on it, it will help a lot

@AsterDY AsterDY added the enhancement New feature or request label Jan 17, 2024
@rts-gordon
Copy link
Author

Those are my project execute files, two methods for json parsing, Windows 10, CPU Intel Core i7.

method1: json parse, execute file size: 48M

 if err := json.Unmarshal(msg, &account); err != nil {
 	log.Errorf("Unmarshal account failed, tenant: %s, platform: %s, error: %s, message: %s", tenant, platform, err.Error(), msg)
 	return
 }

method 2: sonic parse, execute file size: 97M

if err := sonic.Unmarshal(msg, &account); err != nil {
 	log.Errorf("Unmarshal account failed, tenant: %s, platform: %s, error: %s, message: %s", tenant, platform, err.Error(), msg)
 	return
 }

@AsterDY
Copy link
Collaborator

AsterDY commented Jan 18, 2024

Can you try to use older version (<1.10) and give size? If it is still a lot, I doubt that the main cause it doesn't come from C asm files.

@rts-gordon
Copy link
Author

@AsterDY
There are three execute files size, the Sonic old version (<1.10) is normal, maybe version 1.10 changed something.

image

@AsterDY
Copy link
Collaborator

AsterDY commented Jan 22, 2024

ok,It seem native codes need to be embeded on demands. Let me try

@rts-gordon
Copy link
Author

Hi there,
Any update for this issue?

@f3oall
Copy link

f3oall commented Feb 5, 2024

Also, the compilation time is x2 for v1.10, on 1.9.2 it's two times faster.

@nightwolfz
Copy link

Might be useful #561 (comment)

@AsterDY
Copy link
Collaborator

AsterDY commented Feb 8, 2024

Might be useful #561 (comment)

Seem it is due to v1.10 imported iasm as basic assembler (#393), which is used to reslove #489 meanwhile improve C-Go intercall performance. At present, no better solution for this. cc @chenzhuoyu

@AsterDY AsterDY added help wanted Extra attention is needed known-issue This issue is known to us, we are working on it labels Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed known-issue This issue is known to us, we are working on it
Projects
None yet
Development

No branches or pull requests

4 participants