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

can you add "use strict" to odbc.js and simple-queue.js, possible performance gain #320

Closed
amcintyre99 opened this issue Sep 30, 2017 · 2 comments

Comments

@amcintyre99
Copy link

The latest timings I posted in #269 show node 483 still faster with ibm_db than 6x/8x.

My app uses prepare and then execute and executeNonQuery millions of times per day. So I'm wondering if ibm_db using two js modules in the middle of all the fast C++ code, apparently on every call, can be optimized.

Remember what Ben said in #269 :
"Nothing really stands out but I noticed that lib/odbc.js is sloppy mode code. Adding a 'use strict' at the top might help, that gives V8 more leeway to optimize. The file needs to be strict mode compatible, of course, but I expect sloppy mode code will only get penalized more going forward so it pays to switch to strict mode."

I think the flamegraph I added in #269 shows these two js modules could use some speeding up: (you have to scroll way down)
https://cdn.rawgit.com/amcintyre99/18ba434153ed6646f9cf8b4e5afa2b74/raw/dacda1375f31f9e474ea9f319aee5b0b9a51aacb/perf1.svg

MDN article has this quote:
"Certain language functions are so pervasive that performing runtime checks has considerable performance cost. A few strict mode tweaks, plus requiring that user-submitted JavaScript be strict mode code and that it be invoked in a certain manner, substantially reduce the need for those runtime checks."
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode

Found this jsperf which shows strict 7 times faster (ran on chrome 61):
https://jsperf.com/strict-mode-arguments

I tried making the changes myself but I couldn't get it working.

thanks!!

@amcintyre99
Copy link
Author

Actually after adding the two "use strict" statements, then getting one error and commenting out "delete db", which didn't seem needed, benchmark ran fine.

With no change in timings. Oh well, go ahead and close.

@rhtpandeyIN
Copy link
Contributor

Thanks for you feedback.

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

No branches or pull requests

2 participants