Open kamalshkeir opened 1 year ago
sure, will redo benchmark at weekend
Great ! Thanks
updated, but still the korm failed on update postgres benchmark --> https://github.com/kokizzu/gorm-vs-korm/blob/master/korm_postgres_test.go#L36
and also seems the cache no longer work for GetS GetM? (I set the cache to 100MB, that should be larger than estimated ~8MB database size)
hi @kokizzu , Thank you, i see for Update you are asseting there is no error, and it's failing, did you manage to see what is this returned error ? As i said the cache is already defaulted to 100 Mb, i benchmarked with 1 million rows , 1000, 100, working fine for all of them, so i don't understand why you set the cache to 100 Mb and 1Mb , this value is the limit of the size of the all cache, not only the limit of incoming data like the size of the database, so when you set this value to 1Mb it will keep storing and cleaning for nothing also , how can i run these benchmarks on windows ?
PS: you can check the error korm.ErrBigData
You can update to v1.4.5 , now, i put a minimum of cache limit to 50 , and no more error returned if data is too big, it will not be added to the cache, that's it, it should work fine now without any change
install WSL2 I guess
cache set to 1MB is to simulate data larger than RAM 100MB to simulate data not larger than RAM, since the record being benchmarked only 100K
cache set to 1MB is to simulate data larger than RAM 100MB to simulate data not larger than RAM, since the record being benchmarked only 100K
i see, hope it make sense right now, this is the limit for the cache size, if you are inserting 100K you can put 50 Mb Ram , and also it is not very close to reality, because no one will query 100K rows, data are usualy paginated
yes, only first N (not 10K) returned
hi bro, are you going to update benchmarks using cache for korm like next weekend or so ?
already did for korm 1.4.3 5 days ago
already did for korm 1.4.3 5 days ago
yeah thanks, but many changes has been added since, the newest version is 1.4.8 , also you just added korm at the end without disabling cache, since the new version you cannot disable the cache anymore, by default it should be used with , if you encounter an error using it i would rather fix it than disable it
i did it my friend :) :
kamal@PC-KS:~/projects/gorm-vs-korm$ go test -bench=Taran -benchmem .
2023/01/27 22:32:37 postgres
2023/01/27 22:32:37 korm
2023/01/27 22:32:37 pgx
2023/01/27 22:32:37 tarantool
2023/01/27 22:32:37 start test
BenchmarkInsertS_Taran_ORM-32 100000 567107 ns/op 56.71 s
goos: linux
goarch: amd64
pkg: korm1
cpu: Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
BenchmarkInsertS_Taran_ORM-4 100000 567109 ns/op 1078 B/op 26 allocs/op
BenchmarkUpdate_Taran_ORM-32 200000 283 ns/op 0.06 s
BenchmarkUpdate_Taran_ORM-4 0 NaN ns/op 0 B/op 0 allocs/op
BenchmarkGetAllS_Taran_Raw-4 525 2112783 ns/op 936663 B/op 5736 allocs/op
BenchmarkGetAllS_Taran_ORM-4 1579 721029 ns/op 233939 B/op 4714 allocs/op
BenchmarkGetAllA_Taran_ORM-4 1576 693593 ns/op 157543 B/op 4702 allocs/op
BenchmarkGetAllM_Taran_Raw-4 591 2196701 ns/op 1248630 B/op 6734 allocs/op
BenchmarkGetRowS_Taran_Raw-4 20398 57056 ns/op 2584 B/op 59 allocs/op
BenchmarkGetRowM_Taran_Raw-4 21198 67351 ns/op 2584 B/op 59 allocs/op
BenchmarkGetRowS_Taran_ORM-4 34562 30116 ns/op 1115 B/op 27 allocs/op
BenchmarkGetRowM_Taran_Raw2-4 22039 63759 ns/op 2584 B/op 59 allocs/op
BenchmarkGetRowS_Taran_ORM2-4 37310 34005 ns/op 1115 B/op 27 allocs/op
PASS
ok korm1 73.207s
kamal@PC-KS:~/projects/gorm-vs-korm$ go test -bench=Korm -benchmem .
2023/01/27 22:34:13 postgres
2023/01/27 22:34:13 korm
2023/01/27 22:34:13 pgx
2023/01/27 22:34:13 tarantool
2023/01/27 22:34:13 start test
BenchmarkInsertS_Postgres_Korm-32 100000 401998 ns/op 40.20 s
goos: linux
goarch: amd64
pkg: korm1
cpu: Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
BenchmarkInsertS_Postgres_Korm-4 100000 402000 ns/op 3057 B/op 58 allocs/op
BenchmarkUpdate_Postgres_Korm-32 200000 251661 ns/op 50.33 s
BenchmarkUpdate_Postgres_Korm-4 200000 251661 ns/op 1474 B/op 31 allocs/op
BenchmarkGetAllS_Postgres_Korm-4 1570945 732.8 ns/op 240 B/op 3 allocs/op
BenchmarkGetAllM_Postgres_Korm-4 2057124 620.8 ns/op 32 B/op 2 allocs/op
BenchmarkGetRowS_Postgres_Korm-4 14238 168790 ns/op 1392 B/op 36 allocs/op
BenchmarkGetRowM_Postgres_Korm-4 3822 294982 ns/op 1874 B/op 43 allocs/op
BenchmarkGetRowS_Postgres_Korm2-4 850898 28326 ns/op 491 B/op 13 allocs/op
BenchmarkGetRowM_Postgres_Korm2-4 870886 192768 ns/op 1215 B/op 30 allocs/op
PASS
ok korm1 127.030s
kamal@PC-KS:~/projects/gorm-vs-korm$ go test -bench=Gorm -benchmem .
2023/01/27 22:34:13 postgres
2023/01/27 22:34:13 korm
2023/01/27 22:34:13 pgx
2023/01/27 22:34:13 tarantool
2023/01/27 22:34:13 start test
BenchmarkInsertS_Postgres_Gorm-4 100000 978457 ns/op 17284 B/op 172 allocs/op
BenchmarkUpdate_Postgres_Gorm-32 200000 2402 ns/op
BenchmarkUpdate_Postgres_Gorm-4 0 NaN ns/op 0 B/op 0 allocs/op
BenchmarkGetAllS_Postgres_Gorm-4 729 2052911 ns/op 221538 B/op 7809 allocs/op
BenchmarkGetAllM_Postgres_Gorm-4 864 1405830 ns/op 122853 B/op 3237 allocs/op
BenchmarkGetRowS_Postgres_Gorm-4 1321 766825 ns/op 16393 B/op 150 allocs/op
BenchmarkGetRowM_Postgres_Gorm-4 1638 645881 ns/op 16324 B/op 156 allocs/op
kamal@PC-KS:~/projects/gorm-vs-korm$ go test -bench=Pgx -benchmem .
2023/01/27 23:22:00 postgres
2023/01/27 23:22:00 gorm
2023/01/27 23:22:00 korm
2023/01/27 23:22:00 pgx
2023/01/27 23:22:00 tarantool
2023/01/27 23:22:00 start test
BenchmarkInsert_Postgres_Pgx-32 100000 913333 ns/op 91.33 s
goos: linux
goarch: amd64
pkg: korm1
cpu: Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
BenchmarkInsert_Postgres_Pgx-4 100000 913335 ns/op 483 B/op 15 allocs/op
BenchmarkUpdate_Postgres_Pgx-32 200000 949614 ns/op 189.92 s
BenchmarkUpdate_Postgres_Pgx-4 200000 949615 ns/op 447 B/op 15 allocs/op
BenchmarkGetAllS_Postgres_Pgx-4 1573 779752 ns/op 59560 B/op 2968 allocs/op
BenchmarkGetRowS_Postgres_Pgx-4 3710 277754 ns/op 785 B/op 18 allocs/op
Now i understand well how you did these benchmarks, really impressive, tell me if you want me to do a PR to update everything, i have added the Update to gorm and uncomment the Update for korm, these tests was done using const total = 100000
Hi bro, I have added a limit to the cache, so you can use it for benchmarks ( v1.4.3 ) . By default, it is set to100Mb, I did benchmarks on insert of a slice of 1 million User, it works, tell me if you encounter any problem, the behavior is whenever input data is too large , you will get error korm.ErrBigData , and it will not be set to the cache, so you can check this error or ignore it, or increase memory for the cache like so : korm.SetCacheMaxMemory(megaByte int) I'm still learning from your benchmarks, and other repos, you are very talented my friend :)