Browse Source

various optimizations for actix (#3450)

Nikolay Kim 7 years ago
parent
commit
917be7694d

+ 46 - 55
frameworks/Rust/actix/Cargo.lock

@@ -1,20 +1,21 @@
 [[package]]
 name = "actix"
-version = "0.2.0"
+version = "0.3.0"
 dependencies = [
  "actix 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "actix-web 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "askama 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "diesel 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "futures 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
  "http 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "postgres 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "tokio-core 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "tokio-io 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -33,7 +34,7 @@ dependencies = [
  "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "skeptic 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "tokio-core 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "tokio-io 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "tokio-signal 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "trust-dns-resolver 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -72,13 +73,13 @@ dependencies = [
  "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
  "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "skeptic 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
- "tokio-core 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "tokio-io 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "trust-dns-resolver 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -177,7 +178,7 @@ name = "backtrace-sys"
 version = "0.1.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "cc 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cc 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -223,7 +224,7 @@ name = "brotli-sys"
 version = "0.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "cc 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cc 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -267,14 +268,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "semver 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "cc"
-version = "1.0.8"
+version = "1.0.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -670,7 +671,7 @@ dependencies = [
 
 [[package]]
 name = "itoa"
-version = "0.4.0"
+version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -712,14 +713,6 @@ name = "linked-hash-map"
 version = "0.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
-[[package]]
-name = "log"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
 [[package]]
 name = "log"
 version = "0.4.1"
@@ -796,7 +789,7 @@ name = "miniz-sys"
 version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "cc 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cc 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -1093,11 +1086,10 @@ dependencies = [
 
 [[package]]
 name = "remove_dir_all"
-version = "0.3.0"
+version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1156,7 +1148,7 @@ version = "0.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1166,23 +1158,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "serde"
-version = "1.0.33"
+version = "1.0.34"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "serde_derive"
-version = "1.0.33"
+version = "1.0.34"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive_internals 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive_internals 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "serde_derive_internals"
-version = "0.21.0"
+version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1191,13 +1183,13 @@ dependencies = [
 
 [[package]]
 name = "serde_json"
-version = "1.0.12"
+version = "1.0.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "itoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1231,8 +1223,8 @@ dependencies = [
  "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -1314,11 +1306,11 @@ dependencies = [
 
 [[package]]
 name = "tempdir"
-version = "0.3.6"
+version = "0.3.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "remove_dir_all 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1342,13 +1334,13 @@ dependencies = [
 
 [[package]]
 name = "tokio-core"
-version = "0.1.11"
+version = "0.1.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "futures 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
  "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "scoped-tls 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1374,7 +1366,7 @@ dependencies = [
  "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
  "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "mio-uds 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "tokio-core 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "tokio-io 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -1391,7 +1383,7 @@ dependencies = [
  "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "tokio-core 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "tokio-io 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -1408,7 +1400,7 @@ dependencies = [
  "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "resolv-conf 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "tokio-core 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "trust-dns-proto 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -1608,7 +1600,7 @@ dependencies = [
 "checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
 "checksum bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b7db437d718977f6dc9b2e3fd6fc343c02ac6b899b73fdd2179163447bd9ce9"
 "checksum cargo_metadata 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1f56ec3e469bca7c276f2eea015aa05c5e381356febdbb0683c2580189604537"
-"checksum cc 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "d9324127e719125ec8a16e6e509abc4c641e773621b50aea695af3f005656d61"
+"checksum cc 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "2b4911e4bdcb4100c7680e7e854ff38e23f1b34d4d9e079efae3da2801341ffc"
 "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
 "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e"
 "checksum cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "746858cae4eae40fff37e1998320068df317bc247dc91a67c6cfa053afdc2abb"
@@ -1657,7 +1649,7 @@ dependencies = [
 "checksum indexmap 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9378f1f3923647a9aea6af4c6b5de68cc8a71415459ad25ef191191c48f5b7"
 "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
 "checksum ipconfig 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec4e18c0a0d4340870c14284293632d8421f419008371422dd327892b88877c"
-"checksum itoa 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92a9df60778f789c37f76778ae8d0a2471c41baa8b059d98a5873c978f549587"
+"checksum itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682"
 "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
 "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
 "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
@@ -1665,7 +1657,6 @@ dependencies = [
 "checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef"
 "checksum libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "f54263ad99207254cf58b5f701ecb432c717445ea2ee8af387334bdd1a03fdff"
 "checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939"
-"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
 "checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
 "checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21"
 "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
@@ -1709,7 +1700,7 @@ dependencies = [
 "checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
 "checksum regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "aec3f58d903a7d2a9dc2bf0e41a746f4530e0cab6b615494e058f67a3ef947fb"
 "checksum regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b2550876c31dc914696a6c2e01cbce8afba79a93c8ae979d2fe051c0230b3756"
-"checksum remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5d2f806b0fcdabd98acd380dc8daef485e22bcb7cddc811d1337967f2528cf5"
+"checksum remove_dir_all 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dfc5b3ce5d5ea144bb04ebd093a9e14e9765bcfec866aecda9b6dec43b3d1e24"
 "checksum resolv-conf 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e1b086bb6a2659d6ba66e4aa21bde8a53ec03587cd5c80b83bdc3a330f35cab"
 "checksum ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6f7d28b30a72c01b458428e0ae988d4149c20d902346902be881e3edc4bb325c"
 "checksum rustc-demangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11fb43a206a04116ffd7cfcf9bcb941f8eb6cc7ff667272246b0a1c74259a3cb"
@@ -1719,10 +1710,10 @@ dependencies = [
 "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
 "checksum semver 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bee2bc909ab2d8d60dab26e8cad85b25d795b14603a0dcb627b78b9d30b6454b"
 "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-"checksum serde 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe95aa0d46f04ce5c3a88bdcd4114ecd6144ed0b2725ebca2f1127744357807"
-"checksum serde_derive 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "23b163a6ce7e1aa897919f9d8e40bd1f8a6f95342ed57727ae31387a01a7a356"
-"checksum serde_derive_internals 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "370aa477297975243dc914d0b0e1234927520ec311de507a560fbd1c80f7ab8c"
-"checksum serde_json 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "28556329a1d04efa036376c9588a0ed8655e202676d918733ca8a14740ee31be"
+"checksum serde 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "0e100d00fb985a5bf16b857a436450e404fa613de3321b2e383947a93cbd75df"
+"checksum serde_derive 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "86daebd995aa948b069d886f2105f2425cd66103049855e45c15c58c573f12c5"
+"checksum serde_derive_internals 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3f714f52a41e371c5e141e9dafcead60921349bec76b44d79000c88aba3cfc"
+"checksum serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5c508584d9913df116b91505eec55610a2f5b16e9ed793c46e4d0152872b3e74"
 "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
 "checksum sha2 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7daca11f2fdb8559c4f6c588386bed5e2ad4b6605c1442935a7f08144a918688"
 "checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
@@ -1737,10 +1728,10 @@ dependencies = [
 "checksum syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)" = "8c5bc2d6ff27891209efa5f63e9de78648d7801f085e4653701a692ce938d6fd"
 "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
 "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd"
-"checksum tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f73eebdb68c14bcb24aef74ea96079830e7fa7b31a6106e42ea7ee887c1e134e"
+"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
 "checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"
 "checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098"
-"checksum tokio-core 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c87c27560184212c9dc45cd8f38623f37918248aad5b58fb65303b5d07a98c6e"
+"checksum tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "52b4e32d8edbf29501aabb3570f027c6ceb00ccef6538f4bddba0200503e74e8"
 "checksum tokio-io 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b9532748772222bf70297ec0e2ad0f17213b4a7dd0e6afb68e0a0768f69f4e4f"
 "checksum tokio-signal 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e8f46863230f9a05cf52d173721ec391b9c5782a2465f593029922b8782b9ffe"
 "checksum trust-dns-proto 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0266cdf22b1f3904d21252e71079395bc47836513d4f3888ff85b57a6add2227"

+ 8 - 2
frameworks/Rust/actix/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "actix"
-version = "0.2.0"
+version = "0.3.0"
 build = "build.rs"
 
 [[bin]]
@@ -21,10 +21,11 @@ serde = "1.0"
 serde_json = "1.0"
 serde_derive = "1.0"
 rand = "0.4"
+bytes = "0.4"
 num_cpus = "1.0"
 futures = "0.1"
 tokio-io = "=0.1.5"
-tokio-core = "=0.1.11"
+tokio-core = "=0.1.12"
 http = "0.1"
 diesel = { version = "1.1", features = ["postgres"] }
 postgres = "0.15"
@@ -34,3 +35,8 @@ actix-web = "^0.4.10"
 
 [build-dependencies]
 askama = "0.5"
+
+[profile.release]
+lto = true
+opt-level = 3
+codegen-units = 1

+ 16 - 9
frameworks/Rust/actix/src/db.rs

@@ -4,6 +4,7 @@ use rand::{thread_rng, Rng, ThreadRng};
 use actix::prelude::*;
 use diesel;
 use diesel::prelude::*;
+use diesel::result::Error;
 
 use models;
 
@@ -92,17 +93,24 @@ impl Handler<UpdateWorld> for DbExecutor {
             let w_id = self.rng.gen_range::<i32>(1, 10_000);
             let mut w = match world.filter(id.eq(w_id)).load::<models::World>(&self.conn) {
                 Ok(mut items) => items.pop().unwrap(),
-                Err(_) => return Err(io::Error::new(io::ErrorKind::Other, "Database error")),
+                Err(_) => return Err(
+                    io::Error::new(io::ErrorKind::Other, "Database error")),
             };
-
             w.randomnumber = self.rng.gen_range(1, 10_000);
-            let _ = diesel::update(world)
-                .filter(id.eq(w.id))
-                .set(randomnumber.eq(w.randomnumber))
-                .execute(&self.conn);
-
             worlds.push(w);
         }
+        worlds.sort_by_key(|w| w.id);
+
+        let _ = self.conn.transaction::<(), Error, _>(|| {
+            for w in &worlds {
+                let _ = diesel::update(world)
+                    .filter(id.eq(w.id))
+                    .set(randomnumber.eq(w.randomnumber))
+                    .execute(&self.conn);
+            }
+            Ok(())
+        });
+
         Ok(worlds)
     }
 }
@@ -127,8 +135,7 @@ impl Handler<TellFortune> for DbExecutor {
                 items.sort_by(|it, next| it.message.cmp(&next.message));
                 Ok(items)
             }
-            Err(e) =>
-                Err(io::Error::new(io::ErrorKind::Other, e))
+            Err(e) => Err(io::Error::new(io::ErrorKind::Other, e))
         }
     }
 }

+ 15 - 11
frameworks/Rust/actix/src/main.rs

@@ -1,6 +1,7 @@
 extern crate actix;
 extern crate actix_web;
 extern crate http;
+extern crate bytes;
 extern crate rand;
 extern crate num_cpus;
 extern crate futures;
@@ -13,6 +14,7 @@ extern crate serde_json;
 use std::cmp;
 use actix_web::*;
 use actix::prelude::*;
+use bytes::BytesMut;
 use askama::Template;
 use http::header;
 use futures::Future;
@@ -21,6 +23,8 @@ use diesel::prelude::{Connection, PgConnection};
 mod db;
 mod schema;
 mod models;
+mod utils;
+use utils::Writer;
 
 struct State {
     db: Addr<Syn, db::DbExecutor>
@@ -32,11 +36,12 @@ fn world_row(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Err
         .and_then(|res| {
             match res {
                 Ok(row) => {
-                    let body = serde_json::to_string(&row).unwrap();
+                    let mut body = BytesMut::with_capacity(31);
+                    serde_json::to_writer(Writer(&mut body), &row).unwrap();
                     Ok(httpcodes::HTTPOk.build()
                        .header(header::SERVER, "Actix")
                        .content_type("application/json")
-                       .body(body)?)
+                       .body(body.freeze())?)
                 },
                 Err(_) =>
                     Ok(httpcodes::HTTPInternalServerError.into()),
@@ -59,12 +64,12 @@ fn queries(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
         .from_err()
         .and_then(|res| {
             if let Ok(worlds) = res {
-                let body = serde_json::to_string(&worlds).unwrap();
+                let mut body = BytesMut::with_capacity(35 * worlds.len());
+                serde_json::to_writer(Writer(&mut body), &worlds).unwrap();
                 Ok(httpcodes::HTTPOk.build()
                    .header(header::SERVER, "Actix")
                    .content_type("application/json")
-                   .content_encoding(headers::ContentEncoding::Identity)
-                   .body(body)?)
+                   .body(body.freeze())?)
             } else {
                 Ok(httpcodes::HTTPInternalServerError.into())
             }
@@ -86,11 +91,11 @@ fn updates(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
         .from_err()
         .and_then(move |res| {
             if let Ok(worlds) = res {
-                let body = serde_json::to_string(&worlds).unwrap();
+                let mut body = BytesMut::with_capacity(35 * worlds.len());
+                serde_json::to_writer(Writer(&mut body), &worlds).unwrap();
                 Ok(httpcodes::HTTPOk.build()
                    .header(header::SERVER, "Actix")
                    .content_type("application/json")
-                   .content_encoding(headers::ContentEncoding::Identity)
                    .body(body)?)
             } else {
                 Ok(httpcodes::HTTPInternalServerError.into())
@@ -120,8 +125,7 @@ fn fortune(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
                        .content_encoding(headers::ContentEncoding::Identity)
                        .body(res)?)
                 },
-                Err(e) => {
-                    println!("fortune error: {}", e);
+                Err(_) => {
                     Ok(httpcodes::HTTPInternalServerError.into())
                 }
             }
@@ -142,14 +146,14 @@ fn main() {
 
     // Start db executor actors
     let addr = SyncArbiter::start(
-        num_cpus::get() * 4, move || db::DbExecutor::new(&db_url));
+        num_cpus::get() * 4, move || db::DbExecutor::new(db_url));
 
     // start http server
     HttpServer::new(
         move || Application::with_state(State{db: addr.clone()})
             .resource("/db", |r| r.route().a(world_row))
-            .resource("/queries", |r| r.route().a(queries))
             .resource("/fortune", |r| r.route().a(fortune))
+            .resource("/queries", |r| r.route().a(queries))
             .resource("/updates", |r| r.route().a(updates)))
         .backlog(8192)
         .bind("0.0.0.0:8080").unwrap()

+ 35 - 25
frameworks/Rust/actix/src/pg.rs

@@ -1,6 +1,7 @@
 extern crate actix;
 extern crate actix_web;
 extern crate http;
+extern crate bytes;
 extern crate rand;
 extern crate num_cpus;
 extern crate futures;
@@ -15,10 +16,15 @@ use actix_web::*;
 use actix::prelude::*;
 use askama::Template;
 use http::header;
+use bytes::BytesMut;
 use postgres::{Connection, TlsMode};
 use rand::{thread_rng, Rng, ThreadRng};
 use futures::Future;
 
+mod utils;
+use utils::Writer;
+
+
 #[derive(Serialize)]
 pub struct World {
     pub id: i32,
@@ -42,7 +48,8 @@ fn world_row(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Err
         .and_then(|res| {
             match res {
                 Ok(row) => {
-                    let body = serde_json::to_string(&row).unwrap();
+                    let mut body = BytesMut::with_capacity(31);
+                    serde_json::to_writer(Writer(&mut body), &row).unwrap();
                     Ok(httpcodes::HTTPOk.build()
                        .header(header::SERVER, "Actix")
                        .content_type("application/json")
@@ -68,11 +75,11 @@ fn queries(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
         .from_err()
         .and_then(|res| {
             if let Ok(worlds) = res {
-                let body = serde_json::to_string(&worlds).unwrap();
+                let mut body = BytesMut::with_capacity(35 * worlds.len());
+                serde_json::to_writer(Writer(&mut body), &worlds).unwrap();
                 Ok(httpcodes::HTTPOk.build()
                    .header(header::SERVER, "Actix")
                    .content_type("application/json")
-                   .content_encoding(headers::ContentEncoding::Identity)
                    .body(body)?)
             } else {
                 Ok(httpcodes::HTTPInternalServerError.into())
@@ -95,11 +102,11 @@ fn updates(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
         .from_err()
         .and_then(move |res| {
             if let Ok(worlds) = res {
-                let body = serde_json::to_string(&worlds).unwrap();
+                let mut body = BytesMut::with_capacity(35 * worlds.len());
+                serde_json::to_writer(Writer(&mut body), &worlds).unwrap();
                 Ok(httpcodes::HTTPOk.build()
                    .header(header::SERVER, "Actix")
                    .content_type("application/json")
-                   .content_encoding(headers::ContentEncoding::Identity)
                    .body(body)?)
             } else {
                 Ok(httpcodes::HTTPInternalServerError.into())
@@ -173,11 +180,9 @@ impl Handler<RandomWorld> for PgConnection {
             "SELECT id, randomnumber FROM world WHERE id=$1").unwrap();
 
         let random_id = self.rng.gen_range::<i32>(1, 10_000);
-        for row in &random_world.query(&[&random_id]).unwrap() {
-            return Ok(World {id: row.get(0), randomnumber: row.get(1)})
-        }
-
-        Err(io::Error::new(io::ErrorKind::Other, "Database error"))
+        let rows = &random_world.query(&[&random_id]).unwrap();
+        let row = rows.get(0);
+        Ok(World {id: row.get(0), randomnumber: row.get(1)})
     }
 }
 
@@ -197,10 +202,9 @@ impl Handler<RandomWorlds> for PgConnection {
         let mut worlds = Vec::with_capacity(msg.0 as usize);
         for _ in 0..msg.0 {
             let w_id: i32 = self.rng.gen_range(1, 10_000);
-            for row in &random_world.query(&[&w_id]).unwrap() {
-                worlds.push(World {id: row.get(0), randomnumber: row.get(1)});
-                break
-            }
+            let rows = &random_world.query(&[&w_id]).unwrap();
+            let row = rows.get(0);
+            worlds.push(World {id: row.get(0), randomnumber: row.get(1)});
         }
         Ok(worlds)
     }
@@ -218,20 +222,26 @@ impl Handler<UpdateWorld> for PgConnection {
     fn handle(&mut self, msg: UpdateWorld, _: &mut Self::Context) -> Self::Result {
         let get_world = self.conn.prepare_cached(
             "SELECT id FROM world WHERE id=$1").unwrap();
-        let update_world = self.conn.prepare_cached(
-            "UPDATE world SET randomnumber=$1 WHERE id=$2").unwrap();
 
         let mut worlds = Vec::with_capacity(msg.0 as usize);
         for _ in 0..msg.0 {
             let random_id = self.rng.gen_range::<i32>(1, 10_000);
-            for row in &get_world.query(&[&random_id]).unwrap() {
-                let w_id: i32 = row.get(0);
-                let new_num: i32 = self.rng.gen_range(1, 10_000);
-                let _ = update_world.execute(&[&new_num, &w_id]);
-                worlds.push(World{id: w_id, randomnumber: new_num});
-                break
-            }
+            let rows = &get_world.query(&[&random_id]).unwrap();
+            let row = rows.get(0);
+            let w_id: i32 = row.get(0);
+            let new_num: i32 = self.rng.gen_range(1, 10_000);
+            worlds.push(World{id: w_id, randomnumber: new_num});
         }
+        worlds.sort_by_key(|w| w.id);
+
+        let trans = self.conn.transaction().unwrap();
+        let update_world = trans.prepare_cached(
+            "UPDATE world SET randomnumber=$1 WHERE id=$2").unwrap();
+        for w in &worlds {
+            let _ = update_world.execute(&[&w.id, &w.randomnumber]);
+        }
+        trans.commit().unwrap();
+
         Ok(worlds)
     }
 }
@@ -248,7 +258,7 @@ impl Handler<TellFortune> for PgConnection {
     fn handle(&mut self, _: TellFortune, _: &mut Self::Context) -> Self::Result {
         let fortune = self.conn.prepare_cached("SELECT id, message FROM fortune").unwrap();
 
-        let mut items = Vec::with_capacity(13);
+        let mut items = Vec::with_capacity(16);
         items.push(
             Fortune{id: 0,
                     message: "Additional fortune added at request time.".to_string()});
@@ -275,7 +285,7 @@ fn main() {
 
     // Start db executor actors
     let addr = SyncArbiter::start(
-        num_cpus::get() * 4, move || PgConnection::new(&db_url));
+        num_cpus::get() * 4, move || PgConnection::new(db_url));
 
     // start http server
     HttpServer::new(

+ 10 - 3
frameworks/Rust/actix/src/simple.rs

@@ -1,5 +1,6 @@
 extern crate actix;
 extern crate actix_web;
+extern crate bytes;
 extern crate http;
 extern crate futures;
 extern crate serde;
@@ -8,9 +9,14 @@ extern crate serde_json;
 
 use actix_web::*;
 use actix::prelude::*;
+use bytes::BytesMut;
 use http::StatusCode;
 use http::header::{self, HeaderValue};
 
+mod utils;
+use utils::Writer;
+
+const SIZE: usize = 29;
 
 #[derive(Serialize, Deserialize)]
 pub struct Message {
@@ -21,7 +27,8 @@ fn json(_: HttpRequest) -> HttpResponse {
     let message = Message {
         message: "Hello, World!"
     };
-    let body = serde_json::to_string(&message).unwrap();
+    let mut body = BytesMut::with_capacity(SIZE);
+    serde_json::to_writer(Writer(&mut body), &message).unwrap();
 
     let mut resp = HttpResponse::new(StatusCode::OK, body.into());
     resp.headers_mut().insert(
@@ -46,8 +53,8 @@ fn main() {
     // start http server
     HttpServer::new(
         move || Application::new()
-            .resource("/plaintext", |r| r.f(plaintext))
-            .resource("/json", |r| r.f(json)))
+            .resource("/json", |r| r.f(json))
+            .resource("/plaintext", |r| r.f(plaintext)))
         .backlog(8192)
         .bind("0.0.0.0:8080").unwrap()
         .start();

+ 15 - 0
frameworks/Rust/actix/src/utils.rs

@@ -0,0 +1,15 @@
+use std::io;
+use bytes::BytesMut;
+
+
+pub struct Writer<'a>(pub &'a mut BytesMut);
+
+impl<'a> io::Write for Writer<'a> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.0.extend_from_slice(buf);
+        Ok(buf.len())
+    }
+    fn flush(&mut self) -> io::Result<()> {
+        Ok(())
+    }
+}