Skip to content

Mem obj trans #938

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

Merged
merged 3 commits into from
Jul 9, 2025
Merged

Mem obj trans #938

merged 3 commits into from
Jul 9, 2025

Conversation

VadimZhestikov
Copy link
Contributor

@VadimZhestikov VadimZhestikov commented Jul 2, 2025

Memory consumption fixes.

Test results for following test:

function init(size) {
    var o = {};
    for (var i=0; i<size; i++) {
        o[`some_property${i}`] = i;
    }
}

function handler() {
    var size = ("undefined" == typeof scriptArgs) ? Number(process.argv[2]):
       Number(scriptArgs[1]);

    console.log('init size='+size);

    init(size);
}

handler();

############### test-fill-array 1000000

qjs
init size=1000000
        0:00.36 real,   0.34 user,      0.04 sys        RSS:91584kb

njs (this patch)
init size=1000000
        0:00.46 real,   0.33 user,      0.12 sys        RSS:137480kb

njs (before this patch)
init size=1000000
        0:00.94 real,   0.51 user,      0.42 sys        RSS:607656kb

njs v0.8.9 (before "atomic patch")
init size=1000000
        0:00.58 real,   0.38 user,      0.19 sys        RSS:500096kb

############### bench4

qjs
Richards: 896
Crypto: 1070
RayTrace: 988
NavierStokes: 2021
----
Score (version 9): 1176
RSS:6424kb

njs (this patch)
Richards: 590
Crypto: 1008
RayTrace: 421
NavierStokes: 1475
----
Score (version 9): 779
RSS:2103936kb

njs (before this patch)
Richards: 634
Crypto: 985
RayTrace: 505
NavierStokes: 1495
----
Score (version 9): 828
RSS:2710656kb

njs v0.8.9 (before "atomic patch")
Richards: 375
Crypto: 725
RayTrace: 360
NavierStokes: 1345
----
Score (version 9): 602
RSS:2802944kb

@VadimZhestikov VadimZhestikov force-pushed the mem-obj-trans branch 4 times, most recently from 355f3d7 to 37b98f1 Compare July 3, 2025 01:02
xeioex

This comment was marked as resolved.

@VadimZhestikov

This comment was marked as resolved.

@VadimZhestikov
Copy link
Contributor Author

Just updated by commits from #935

@VadimZhestikov VadimZhestikov force-pushed the mem-obj-trans branch 11 times, most recently from fac706b to d844527 Compare July 7, 2025 21:59
@VadimZhestikov VadimZhestikov requested a review from xeioex July 7, 2025 22:10
@VadimZhestikov VadimZhestikov marked this pull request as ready for review July 7, 2025 22:10
@VadimZhestikov VadimZhestikov force-pushed the mem-obj-trans branch 8 times, most recently from dd08598 to eb1c9ad Compare July 9, 2025 13:55
@VadimZhestikov VadimZhestikov force-pushed the mem-obj-trans branch 3 times, most recently from 716649e to 79e52ae Compare July 9, 2025 19:05
The new hash takes 42% less memory per element.
Copy link
Contributor

@xeioex xeioex left a comment

Choose a reason for hiding this comment

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

LGTM.

@VadimZhestikov VadimZhestikov merged commit 2f288a9 into nginx:master Jul 9, 2025
1 check 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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy