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

add optimizer #633

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

add optimizer #633

wants to merge 5 commits into from

Conversation

Uzlopak
Copy link
Contributor

@Uzlopak Uzlopak commented Jul 26, 2023

Checklist

@mcollina
Copy link
Member

how much perf would this get us?

@Uzlopak
Copy link
Contributor Author

Uzlopak commented Jul 26, 2023

I am still investigating

lib/optimize.js Outdated
@@ -0,0 +1,87 @@
'use strict'

const serializerReturnRE = /^return ([a-zA-Z0-9]+)\(\w+\)$/
Copy link
Member

Choose a reason for hiding this comment

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

How do you write this code?
Do you follow some automation?

Only AI will be able to read it tho

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Manually. Writing my unit test, then adapt to what I prefer.

@Uzlopak Uzlopak force-pushed the add-optimizer branch 2 times, most recently from 401efc3 to 592b3e7 Compare July 27, 2023 09:16
@Uzlopak

This comment was marked as outdated.

@Uzlopak Uzlopak added the benchmark Label to run benchmark against PR and main branch label Jul 27, 2023
@github-actions

This comment was marked as outdated.

@github-actions github-actions bot removed the benchmark Label to run benchmark against PR and main branch label Jul 27, 2023
@Uzlopak Uzlopak added the benchmark Label to run benchmark against PR and main branch label Aug 1, 2023
@github-actions
Copy link

github-actions bot commented Aug 1, 2023

PR:

short string............................................. x 11,803,909 ops/sec ±0.38% (193 runs sampled)
short string with double quote........................... x 7,693,971 ops/sec ±0.15% (194 runs sampled)
long string without double quotes........................ x 12,623 ops/sec ±0.30% (194 runs sampled)
long string.............................................. x 11,167 ops/sec ±0.18% (194 runs sampled)
number................................................... x 708,759,625 ops/sec ±0.09% (194 runs sampled)
integer.................................................. x 147,420,378 ops/sec ±0.12% (194 runs sampled)
formatted date-time...................................... x 2,104,912 ops/sec ±0.15% (194 runs sampled)
formatted date........................................... x 1,527,222 ops/sec ±0.15% (194 runs sampled)
formatted time........................................... x 1,530,488 ops/sec ±0.21% (194 runs sampled)
short array of numbers................................... x 50,510 ops/sec ±0.30% (193 runs sampled)
short array of integers.................................. x 43,760 ops/sec ±0.33% (194 runs sampled)
short array of short strings............................. x 11,712 ops/sec ±0.26% (193 runs sampled)
short array of long strings.............................. x 11,717 ops/sec ±0.23% (193 runs sampled)
short array of objects with properties of different types x 5,721 ops/sec ±0.27% (194 runs sampled)
object with number property.............................. x 702,446,223 ops/sec ±0.09% (194 runs sampled)
object with integer property............................. x 146,067,259 ops/sec ±0.10% (194 runs sampled)
object with short string property........................ x 11,609,885 ops/sec ±0.21% (193 runs sampled)
object with long string property......................... x 11,111 ops/sec ±0.19% (194 runs sampled)
object with properties of different types................ x 1,071,796 ops/sec ±0.39% (192 runs sampled)
simple object............................................ x 5,261,622 ops/sec ±0.19% (192 runs sampled)
simple object with required fields....................... x 5,323,505 ops/sec ±0.17% (189 runs sampled)
object with const string property........................ x 708,716,498 ops/sec ±0.10% (194 runs sampled)
object with const number property........................ x 708,124,459 ops/sec ±0.10% (194 runs sampled)
object with const bool property.......................... x 708,906,284 ops/sec ±0.10% (194 runs sampled)
object with const object property........................ x 708,516,305 ops/sec ±0.13% (193 runs sampled)
object with const null property.......................... x 709,119,322 ops/sec ±0.08% (194 runs sampled)

MASTER:

short string............................................. x 13,116,407 ops/sec ±0.36% (192 runs sampled)
short string with double quote........................... x 8,215,053 ops/sec ±1.53% (191 runs sampled)
long string without double quotes........................ x 12,642 ops/sec ±0.39% (193 runs sampled)
long string.............................................. x 11,095 ops/sec ±0.22% (194 runs sampled)
number................................................... x 707,322,962 ops/sec ±0.08% (194 runs sampled)
integer.................................................. x 147,242,881 ops/sec ±0.09% (194 runs sampled)
formatted date-time...................................... x 2,097,135 ops/sec ±0.11% (194 runs sampled)
formatted date........................................... x 1,522,072 ops/sec ±0.18% (194 runs sampled)
formatted time........................................... x 1,523,511 ops/sec ±0.17% (193 runs sampled)
short array of numbers................................... x 50,210 ops/sec ±0.32% (194 runs sampled)
short array of integers.................................. x 42,927 ops/sec ±0.28% (194 runs sampled)
short array of short strings............................. x 12,355 ops/sec ±0.22% (194 runs sampled)
short array of long strings.............................. x 12,290 ops/sec ±0.25% (193 runs sampled)
short array of objects with properties of different types x 6,084 ops/sec ±0.28% (192 runs sampled)
object with number property.............................. x 702,640,549 ops/sec ±0.10% (194 runs sampled)
object with integer property............................. x 148,226,732 ops/sec ±0.07% (194 runs sampled)
object with short string property........................ x 12,823,323 ops/sec ±0.39% (193 runs sampled)
object with long string property......................... x 11,119 ops/sec ±0.18% (193 runs sampled)
object with properties of different types................ x 1,191,205 ops/sec ±0.30% (191 runs sampled)
simple object............................................ x 5,983,056 ops/sec ±0.19% (194 runs sampled)
simple object with required fields....................... x 5,883,492 ops/sec ±0.16% (194 runs sampled)
object with const string property........................ x 709,006,986 ops/sec ±0.09% (194 runs sampled)
object with const number property........................ x 709,278,837 ops/sec ±0.10% (194 runs sampled)
object with const bool property.......................... x 708,819,907 ops/sec ±0.11% (193 runs sampled)
object with const object property........................ x 708,974,433 ops/sec ±0.09% (194 runs sampled)
object with const null property.......................... x 709,339,584 ops/sec ±0.09% (194 runs sampled)

@github-actions github-actions bot removed the benchmark Label to run benchmark against PR and main branch label Aug 1, 2023
@cesco69
Copy link
Contributor

cesco69 commented Mar 1, 2024

@Uzlopak this PR looks very interesting, why not keep working on it?

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.

None yet

4 participants