#include <iostream>
#include <chrono>
int main(){
auto start_time = std::chrono::steady_clock::now();
long long c = 0;
for(long long i = 0; i < 1000000000; i++){
c+=c xor i;
}
auto end_time = std::chrono::steady_clock::now();
auto elapsed_ns = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time);
std::cout << elapsed_ns.count() << " ms\n";
std::cout << c << std::endl;
return 1;
}
package main
import (
"fmt"
"time"
)
func main(){
var f int64 = 0
var i int64 = 0
start := time.Now()
for i = 0; i < 1000000000; i++{
f+=f ^ i
}
duration := time.Since(start)
fmt.Println(duration)
fmt.Println(f)
}
//http
const express = require('express');
const server = require('http')
var app = express();
var server = server.Server(app);
server.listen(3000);
//socket
Socket.io = require('socket.io')(3001, { path: '/', });
# Для стандартных пост гет запросов (запросы, естественно, будут на site/api/)
location /api/ {
expires $expires;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 30m;
proxy_connect_timeout 30m;
send_timeout 30m;
proxy_pass http://127.0.0.1:3000/; # set the adress of the Node.js instance here
}
# Для сокетов
location /socket/ {
expires $expires;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade; #для сокетов
proxy_set_header Connection "upgrade"; #для сокетов
proxy_http_version 1.1;
proxy_read_timeout 30m;
proxy_connect_timeout 30m;
send_timeout 30m;
proxy_pass http://127.0.0.1:3001; # set the adress of the Node.js instance here
# proxy_ssl_server_name on;
}