-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the sqlboiler benchmark #269
Conversation
Did not update the readme numbers since I don't have the same hardware and don't have the other ORMs set up properly.
Hello, Looks fine to me and I certainly can merge this right now, but benchmark results on |
- Add disclaimer about out of date benchmark - Replace out of date benchmark with XXX - Tune wording around sqlboiler's performance
Thanks @roobre. I did take the liberty! I hope the changes I've made are acceptable and thanks for being fair about it and allowing me to make the disclaimer. It was a lot of fun profiling kallax and sqlboiler (did some flame graphs) and also seeing the different approaches we both took in the APIs. I'd also like to share something I found interesting about the way kallax works too. If you look at it's use of the squirrel cache, that cache is never cleared. Prepared statements use memory on the database and the client and are meant to have Thanks :) |
They look indeed good to me. Of course, it's the least I can do :D
I was aware of memory being leaked (while investigating #263), but not about the exact place. Thanks for sharing your findings!
That's certainly something I did not know. As I only miantain kallax recently, I don't know why prepared statements where chosen on the first place. Perhaps for the free sql sanitizing? What I do know is A fix for that memory leak is something that indeed needs addressing. I will try to get some free time and actually work on a fix. Anyway, I'm merging this to get the README updated. I'll hopefully rerun the benchmarks and get them a full refresh soon. Thanks for your effort, @aarondl! |
Thanks for the merge. A couple more notes on caching/performance/prepared statements: I benchmarked 10,000 inserts with a for loop, prepared statements, and a transaction. They took 8.6s, 8.2s and 800ms respectively. I also have a hunch that the sql library itself uses prepared statements for every single query by default for the sql sanitizing, so creating one manually doesn't affect performance much. It seems a bit improbable so I just re-checked and those results are consistent. There's a way to turn off the cache so you can test easily https://godoc.org/gopkg.in/src-d/go-kallax.v1#Store.DisableCacher (not sure if you know since you aren't one of the original authors) which affects this: https://github.com/src-d/go-kallax/blob/v1.3.4/store.go#L138 |
Did not update the readme numbers since I don't have the same hardware and
don't have the other ORMs set up properly.
This patch significantly speeds up the InsertWithRelationships benchmark. Typically transactions should be being used in calls like this. The API that SQLBoiler has makes it a concious choice when to use them, props to Kallax for having these happen automatically when appropriate.
Also fixes an error where the benchmarks no longer run (go vet now runs automatically as of Go 1.10).