Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GORM головного мозга

GORM головного мозга

by Мария Булатова

Iskander (Alex) Sharipov

July 27, 2019
Tweet

More Decks by Iskander (Alex) Sharipov

Other Decks in Programming

Transcript

  1. Benchmarks - Insert https://github.com/nashtsai/orm-benchmark https://github.com/kihamo/orm-benchmark 2000 times — Insert raw:

    3.67s 1835258 ns/op 624 B/op 17 allocs/op orm: 3.97s 1986971 ns/op 1592 B/op 43 allocs/op qbs: 4.03s 2013782 ns/op 5575 B/op 111 allocs/op raw_np: 4.51s 2256832 ns/op 1051 B/op 20 allocs/op gorp: 5.14s 2569561 ns/op 1459 B/op 34 allocs/op xorm: 5.42s 2709375 ns/op 2743 B/op 88 allocs/op modl: 5.59s 2793891 ns/op 1387 B/op 33 allocs/op hood: 5.85s 2926226 ns/op 12228 B/op 209 allocs/op upper.io: 6.95s 3475133 ns/op 12481 B/op 454 allocs/op gorm: 7.31s 3652659 ns/op 7869 B/op 155 allocs/op 1.5x головноslower
  2. Benchmarks - Update https://github.com/nashtsai/orm-benchmark https://github.com/kihamo/orm-benchmark 2000 times — Update upper.io:

    2.38s 1191920 ns/op 13619 B/op 457 allocs/op qbs: 3.51s 1753295 ns/op 5571 B/op 111 allocs/op raw: 4.21s 2105541 ns/op 688 B/op 19 allocs/op orm: 4.28s 2142098 ns/op 1536 B/op 43 allocs/op gorp: 5.00s 2499496 ns/op 1608 B/op 40 allocs/op raw_nop: 5.55s 2774600 ns/op 1168 B/op 23 allocs/op xorm: 5.73s 2866950 ns/op 2953 B/op 109 allocs/op hood: 5.79s 2893514 ns/op 12226 B/op 209 allocs/op modl: 6.70s 3349130 ns/op 1560 B/op 41 allocs/op gorm: 12.72s 6358747 ns/op 20293 B/op 412 allocs/op 2.5x головноslower
  3. Benchmarks - Read https://github.com/nashtsai/orm-benchmark https://github.com/kihamo/orm-benchmark 2000 times — Read orm:

    0.59s 146428 ns/op 2746 B/op 99 allocs/op qbs: 0.61s 152806 ns/op 8033 B/op 182 allocs/op gorp: 1.47s 366656 ns/op 1945 B/op 57 allocs/op raw_nop: 1.47s 367865 ns/op 1641 B/op 46 allocs/op raw: 2.50s 624899 ns/op 1497 B/op 42 allocs/op hood: 2.95s 736492 ns/op 4386 B/op 65 allocs/op gorm: 3.70s 924227 ns/op 12224 B/op 244 allocs/op upper.io: 3.92s 980828 ns/op 31257 B/op 773 allocs/op modl: 5.40s 1348838 ns/op 1946 B/op 50 allocs/op xorm: 6.98s 1745925 ns/op 9476 B/op 266 allocs/op ~2x головноslower
  4. Benchmarks https://github.com/nashtsai/orm-benchmark https://github.com/kihamo/orm-benchmark 2000 times - MultiRead limit 100 modl:

    1.64s 817910 ns/op 49920 B/op 1726 allocs/op gorp: 1.86s 930041 ns/op 64452 B/op 2042 allocs/op raw_nop: 1.97s 982513 ns/op 44344 B/op 1514 allocs/op raw: 2.19s 1096484 ns/op 34776 B/op 1325 allocs/op orm: 2.52s 1262212 ns/op 85176 B/op 4289 allocs/op qbs: 2.96s 1480821 ns/op 205325 B/op 6434 allocs/op hood: 3.62s 1808326 ns/op 232498 B/op 8775 allocs/op gorm: 4.32s 2161877 ns/op 254838 B/op 6232 allocs/op xorm: 5.95s 2975603 ns/op 180200 B/op 8097 allocs/op upper.io: 27.12s 13562345 ns/op 2859532 B/op 71068 allocs/op ~2x головноslower
  5. Create Table CREATE TABLE `users` (`id` int AUTO_INCREMENT, `name` varchar(255),

    `created` timestamp NULL, `age` int , PRIMARY KEY (`id`)) db.CreateTable(User{}) db.Debug().CreateTable(User{})