-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Small optimization for parseUnsignedNumber #700
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
Conversation
a lot of failed tests |
Yea, looks like I made a logic error in the offset calculation. |
OK, code is corrected and tests are passing. |
lgtm, but I'll wait for benchmark (it's 2 hours wrk load test) |
No problem. Obviously I'm only interested in the patch if it actually makes any real difference, since it is an optimization :) |
Just ran this through my faster than c benchmark (heavy row data parsing): https://docs.google.com/spreadsheet/ccc?key=0ApjTSpxgQIZtdFZRcXpiNUFMck5uZFlBX1lObkJnTWc&usp=sharing Seems like your patch makes things a little faster. That being said, I only ran the benchmarks once, and my computer had a few other things running : ). Looking to hear from @sidorares . |
Thanks, @felixge :) Right now I'm actually going to say to hold off on merging this for the time being. There is another spot that can have a simple change that would also have an additional improvement like this, but more importantly, I need to be sure this change works the same as the old all the way up to the max 4 byte value. |
My benchmarks: npm/2.0rc2
dougwilson:parse-unsigned-optimization
test setup - 3 Amazon VMs in the same subnet, 2 t1.micro (server + load test client) + db.t1.micro MySQL RDS
10000 rows total. Server under benchmark - t1.micro
Benchmark results with node-mysql2
|
Thanks, @sidorares :) As an update, I have moved this to #702 which implements the |
* Fixed broken import for appengine/cloudsql appengine.go import path of appengine/cloudsql has changed to google.golang.org/appengine/cloudsql - Fixed. * Added my name to the AUTHORS
This implements a small optimization for the
parseUnsignedNumber
method in the parser. This method is called multiple times for parsing almost all packets, making a gain here seem like it would be pretty nice. Checking out a simple test on jsperf it seems like it would make this method about 3x faster than what it is now. I cannot say if this actually has any real-world performance impacts yet, though.