Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

UUID result #225

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 2 commits into from
Jun 3, 2025
Merged

UUID result #225

merged 2 commits into from
Jun 3, 2025

Conversation

adespawn
Copy link
Collaborator

@adespawn adespawn commented May 29, 2025

Update UUID, so that we return raw bytes instead of object wrapper.

Removes CqlTypeClass, to reduce the overhead from it's type.
This means, that array will be treated as ambiguous types in result wrapping.

This provides about 25% time improvement time elapsed:

Before

sudo perf stat node ./benchmark/logic/concurrent_select.js scylladb-javascript-driver 300000

 Performance counter stats for 'node ./benchmark/logic/concurrent_select.js scylladb-javascript-driver 300000':

         33,278.45 msec task-clock                       #    1.618 CPUs utilized             
           448,180      context-switches                 #   13.468 K/sec                     
           160,090      cpu-migrations                   #    4.811 K/sec                     
            67,942      page-faults                      #    2.042 K/sec                     
   124,413,648,358      cycles                           #    3.739 GHz                       
    48,582,787,534      stalled-cycles-frontend          #   39.05% frontend cycles idle      
   109,354,731,390      instructions                     #    0.88  insn per cycle            
                                                  #    0.44  stalled cycles per insn   
    20,753,228,584      branches                         #  623.624 M/sec                     
       585,833,793      branch-misses                    #    2.82% of all branches           

      20.562829716 seconds time elapsed

      24.754476000 seconds user
       8.881299000 seconds sys

After:

sudo perf stat node ./benchmark/logic/concurrent_select.js scylladb-javascript-driver 300000

 Performance counter stats for 'node ./benchmark/logic/concurrent_select.js scylladb-javascript-driver 300000':

         28,658.52 msec task-clock                       #    1.718 CPUs utilized             
           384,096      context-switches                 #   13.403 K/sec                     
           126,869      cpu-migrations                   #    4.427 K/sec                     
            41,419      page-faults                      #    1.445 K/sec                     
   105,013,076,940      cycles                           #    3.664 GHz                       
    40,753,024,207      stalled-cycles-frontend          #   38.81% frontend cycles idle      
    95,126,229,441      instructions                     #    0.91  insn per cycle            
                                                  #    0.43  stalled cycles per insn   
    18,313,277,308      branches                         #  639.017 M/sec                     
       529,455,973      branch-misses                    #    2.89% of all branches           

      16.684932131 seconds time elapsed

      20.733184000 seconds user
       8.202016000 seconds sys

adespawn added 2 commits May 29, 2025 12:50
Removes CqlTypeClass, to reduce the overhead from it's type.
This means, that array will be treated as ambiguous types.
@adespawn adespawn requested a review from wprzytula May 29, 2025 11:22
@wprzytula
Copy link
Contributor

This means, that array will be treated as ambiguous types in result wrapping.

  1. What array?
  2. What does it mean that it will be treated as ambiguous? Can you provide an example?

],
)
}
unsafe { Vec::to_napi_value(env, vec![CqlType::to_napi_value(env, typ), value]) }
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 Allocating the outermost Vec seems redundant, because the only thing that we do with it is creating a JS Array based on it. Maybe instead we could create the Array straight away?

I we employ this pattern codewide, we could even write a macro: js_array![env, ...elems], which would be analogous to vec![...elems].

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, but I will prefer to update it another PR as this approach is not introduced here (and currently don't have time for such experiments).

Comment on lines +272 to +277
Vec::to_napi_value(
env,
val.into_iter()
.map(|e| CqlValueWrapper::to_napi_value(env, CqlValueWrapper { inner: e }))
.collect(),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. We could collect() the iterator directly into JS array.

@adespawn
Copy link
Collaborator Author

1. What array?

CqlList and CqlSet

2. What does it mean that it will be treated as ambiguous? Can you provide an example?

This means, there will be no separate case for Array, and it will be moved into the second case (as listed in getCqlObject documentation)

@wprzytula
Copy link
Contributor

So as discussed, there will be no longer ambiguity, because the problematic case of plain Array will be replaced with (Type, Array).

@wprzytula wprzytula merged commit f70fbd9 into second-iteration Jun 3, 2025
9 checks passed
@wprzytula wprzytula deleted the uuid-result branch June 3, 2025 10:52
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.