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
time: LoadLocation is slow #26106
Comments
Please show the numbers for your or any other machine, thanks. |
Above is benchmark result and snippet I used is the following
|
This is expected based on LoadLocation's godoc (multiple mentions of file reading). Further, even if a user doesn't read the godoc, "Load" in the function name should make the disk reading unsurprising. So I think we can agree that some slowness should be expected.
I wonder if there is a precedent in the standard library for caching something like this. If not, maybe caching should be left to the user of the library since anything short of caching everything (which we definitely don't want in the std lib) is highly dependent on usage patterns: how many entries should be cached? should the number of entries in the cache be configurable? should there be an eviction policy or should items be cached forever? etc. |
The docs for I agree that |
Well, that is what this issue is about. For reference, this came from here - #24844 (comment). @zhexuany is aware that If the decision is that |
Yes. Our solution is to wrap |
Caching |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.10
Does this issue reproduce with the latest release?
Just benchmark
time.LocadLocation
.What operating system and processor architecture are you using (
go env
)?What did you do?
Just benchmark
LoadLocation
, you will see the result.What did you expect to see?
Each
LoadLocation
should be finished in a very reasonable time.What did you see instead?
Each
LoadLocation
takes about 30us. It is huge.@ALTree Here is the issue.
If
go
can do some kinda cache of location, that will be better. Right now,LoadLocation
is relatively slow.The text was updated successfully, but these errors were encountered: