Skip to content

Instantly share code, notes, and snippets.

View sidorares's full-sized avatar

Andrey Sidorov sidorares

View GitHub Profile
@sidorares
sidorares / gist:4965998
Created February 16, 2013 07:52
Projects I mentioned during "desktop node.js applications" workshop at campjs.com
https://github.com/rogerwang/node-webkit
https://github.com/appjs/appjs
https://github.com/creationix/node-gir
https://github.com/TooTallNate/NodObjC
https://github.com/arturadib/node-qt
https://github.com/sidorares/node-x11
https://github.com/sidorares/ntk
https://github.com/sidorares/node-vnc
node-mysql2:
wrk git:master ❯ ./wrk -c 200 "http://localhost:8080/mysql?queries=1" -d60
Running 1m test @ Chttp://localhost:8080/mysql?queries=1
2 threads and 200 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 43.77ms 20.00ms 116.91ms 65.06%
Req/Sec 3.00k 1.00k 4.00k 49.94%
397508 requests in 1.00m, 69.67MB read
Requests/sec: 6624.97
/**
* A subimage finder (c) Werner Van Belle - 2007
* mailto: [email protected]
*/
#include <assert.h>
#include <qcolor.h>
#include <math.h>
#include <fftw3.h>
#include <qimage.h>
#include <qrgb.h>
@sidorares
sidorares / ping-pong-client.js
Created May 14, 2013 01:52
network roundtrip time benchmark
var net = require('net');
var count = 0;
var byte = new Buffer([0x33]);
function pong() {
count++;
this.write(byte);
}
var c = net.connect(3334);
#include <SDKDDKVer.h>
#include <Windows.h>
#pragma warning(disable:4819)
#pragma warning(disable:4996)
// for OpenCV2
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/gpu/gpu.hpp"
var mysql = require('mysql2');
var id = 0;
var server = mysql.createServer().listen(3307);
server.on('connection', function(conn) {
var remote = mysql.createConnection({user: 'root', database: 'test'});
conn.serverHandshake({
protocolVersion: 10,
serverVersion: 'node.js mysql proxy',
connectionId: id++,
statusFlags: 2,
@sidorares
sidorares / results
Created May 20, 2013 14:35
parseInt(Buffer.toString()) vs manual parsing
var total = 1000000;
var buf = new Buffer(total*8);
var zero = '0'.charCodeAt(0);
for(var i=0; i < total*8; i++)
{
buf[i] = zero + Math.floor(Math.random()*10);
}
var minus = '-'.charCodeAt(0);
var plus = '+'.charCodeAt(0);
#include <iostream>
#include <vector>
int tree[] = {
1, 3, 6,
2, 9, 12,
3, 15, 18,
4, 21, -1,
5, 24, 27,
6, -1, -1,
@sidorares
sidorares / gist:6545549
Last active December 22, 2015 23:18
SELECT IN / NOT IN + prepared statements test
mysql> select * from insert_test limit 10;
+----+--------------+
| id | title |
+----+--------------+
| 1 | test abc xyz |
| 2 | test abc xyz |
| 3 | test abc xyz |
| 4 | test abc xyz |
| 5 | test abc xyz |
| 6 | test abc xyz |
@sidorares
sidorares / output.txt
Created September 27, 2013 02:31
node.js empty loop optimisation test
[marking boo 0x168ec4f7ae88 for recompilation, reason: small function, ICs with typeinfo: 1/8 (12%)]
Analyzing block B0
Initial inferred range of 1 (Constant) set to [-2147483648,2147483647]
Initial inferred range of 54 (Constant) set to [1,1]
Initial inferred range of 15 (Constant) set to [-2147483648,2147483647]
Initial inferred range of 2 (ArgumentsObject) set to [-2147483648,2147483647]
Initial inferred range of 3 (Parameter) set to [-2147483648,2147483647]
Initial inferred range of 4 (Context) set to [-2147483648,2147483647]
Analyzing block B1
Initial inferred range of 10 (LoadGlobalCell) set to [-2147483648,2147483647]