blastrain / rapidash

Go package for database record or other data caching
MIT License
81 stars 9 forks source link

Fix replace modules #35

Closed kanataxa closed 4 years ago

kanataxa commented 4 years ago
goccy commented 4 years ago

LGTM 👍

kanataxa commented 4 years ago

I run benchmark test go test -bench . -benchmem

master

BenchmarkGetByPrimaryKey_DatabaseSQL-8             10000        144653 ns/op        1442 B/op         41 allocs/op
BenchmarkGetByPrimaryKey_GORM-8                    10000        172036 ns/op       10118 B/op        201 allocs/op
BenchmarkGetByPrimaryKey_RapidashWorst-8            5000        317513 ns/op       10009 B/op        243 allocs/op
BenchmarkGetByPrimaryKey_RapidashBest-8            30000         66084 ns/op        5355 B/op        120 allocs/op
BenchmarkInsert_DatabaseSQL-8                       3000        509572 ns/op        1236 B/op         25 allocs/op
BenchmarkInsert_GORM-8                              3000        491035 ns/op        5829 B/op        118 allocs/op
BenchmarkInsert_Rapidash-8                          2000        655640 ns/op       13163 B/op        303 allocs/op
BenchmarkUpdateByPrimaryKey_DatabaseSQL-8           3000        607391 ns/op         675 B/op         17 allocs/op
BenchmarkUpdateByPrimaryKey_GORM-8                  2000        649097 ns/op       11816 B/op        229 allocs/op
BenchmarkUpdateByPrimaryKey_RapidashWorst-8         2000        786706 ns/op       12631 B/op        310 allocs/op
BenchmarkUpdateByPrimaryKey_RapidashBest-8          3000        593409 ns/op        8259 B/op        192 allocs/op
BenchmarkDeleteByPrimaryKey_DatabaseSQL-8           3000        791740 ns/op         579 B/op         17 allocs/op
BenchmarkDeleteByPrimaryKey_GORM-8                  3000        471187 ns/op        3789 B/op         80 allocs/op
BenchmarkDeleteByPrimaryKey_Rapidash-8              3000        610121 ns/op        3202 B/op         80 allocs/op
BenchmarkPK_MySQL-8                                  100      20197486 ns/op      179747 B/op       4594 allocs/op
BenchmarkPK_Rapidash-8                             20000         74329 ns/op       17227 B/op        300 allocs/op
BenchmarkIN_MySQL-8                                  100      16949985 ns/op      423084 B/op      13500 allocs/op
BenchmarkIN_Rapidash-8                              3000        462042 ns/op      154785 B/op       3700 allocs/op
BenchmarkSLCIN_SimpleMemcachedAccess-8             10000        109537 ns/op        9761 B/op        249 allocs/op
BenchmarkSLCIN_SimpleRedisAccess-8                 10000        119158 ns/op       27400 B/op        257 allocs/op
BenchmarkSLCIN_MySQL-8                             10000        164849 ns/op        3285 B/op         96 allocs/op
BenchmarkSLCIN_Rapidash_Memcached-8                10000        138374 ns/op       15854 B/op        358 allocs/op
BenchmarkSLCIN_Rapidash_Redis-8                    10000        229240 ns/op       33429 B/op        361 allocs/op

feature/fix-replace-modules

BenchmarkGetByPrimaryKey_DatabaseSQL-8             10000        144843 ns/op        1442 B/op         41 allocs/op
BenchmarkGetByPrimaryKey_GORM-8                    10000        170026 ns/op       10119 B/op        201 allocs/op
BenchmarkGetByPrimaryKey_RapidashWorst-8            5000        265322 ns/op       10009 B/op        243 allocs/op
BenchmarkGetByPrimaryKey_RapidashBest-8            30000         52228 ns/op        5355 B/op        120 allocs/op
BenchmarkInsert_DatabaseSQL-8                       3000        421674 ns/op        1236 B/op         25 allocs/op
BenchmarkInsert_GORM-8                              3000        435772 ns/op        5829 B/op        118 allocs/op
BenchmarkInsert_Rapidash-8                          2000        571101 ns/op       13163 B/op        303 allocs/op
BenchmarkUpdateByPrimaryKey_DatabaseSQL-8           3000        438857 ns/op         678 B/op         17 allocs/op
BenchmarkUpdateByPrimaryKey_GORM-8                  3000        487654 ns/op       11813 B/op        229 allocs/op
BenchmarkUpdateByPrimaryKey_RapidashWorst-8         2000        739381 ns/op       12628 B/op        310 allocs/op
BenchmarkUpdateByPrimaryKey_RapidashBest-8          3000        551932 ns/op        8264 B/op        192 allocs/op
BenchmarkDeleteByPrimaryKey_DatabaseSQL-8           3000        437406 ns/op         579 B/op         17 allocs/op
BenchmarkDeleteByPrimaryKey_GORM-8                  3000        445728 ns/op        3788 B/op         80 allocs/op
BenchmarkDeleteByPrimaryKey_Rapidash-8              3000        478392 ns/op        3202 B/op         80 allocs/op
BenchmarkPK_MySQL-8                                  200       9761840 ns/op      180191 B/op       4594 allocs/op
BenchmarkPK_Rapidash-8                             20000         62465 ns/op       17227 B/op        300 allocs/op
BenchmarkIN_MySQL-8                                  100      11911060 ns/op      423088 B/op      13500 allocs/op
BenchmarkIN_Rapidash-8                              3000        418437 ns/op      154786 B/op       3700 allocs/op
BenchmarkSLCIN_SimpleMemcachedAccess-8             20000         93169 ns/op        9761 B/op        249 allocs/op
BenchmarkSLCIN_SimpleRedisAccess-8                 10000        107418 ns/op       27400 B/op        257 allocs/op
BenchmarkSLCIN_MySQL-8                             10000        153077 ns/op        3285 B/op         96 allocs/op
BenchmarkSLCIN_Rapidash_Memcached-8                10000        147925 ns/op       15849 B/op        358 allocs/op
BenchmarkSLCIN_Rapidash_Redis-8                    10000        207233 ns/op       33440 B/op        361 allocs/op
goccy commented 4 years ago

Thanks !