Skip to content
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

Optimize closure and newvar storage #10224

Closed
SimonDanisch opened this issue Feb 17, 2015 · 4 comments
Closed

Optimize closure and newvar storage #10224

SimonDanisch opened this issue Feb 17, 2015 · 4 comments
Labels
performance Must go faster

Comments

@SimonDanisch
Copy link
Contributor

As nobody found a good reason why let blocks generate non optimal code, I consider this as a bug.
Excerpt from julia-users:

I was trying to find out, what the best way is to have some local, constant storage for a function, which is only accessible from inside the function. I was quite surprised, that you can't do this efficiently.
Or at least I didn't find a way, or tested it incorrectly.
Here are the different combinations I tried and the emitted native code:
https://gist.github.com/SimonDanisch/e4bed0a16bdd847a8c2b#file-local_function_storage-jl
test11 && test12 seems to be what julia does internally for test1-test4 (and the example here)
It's especially odd, as a global const seems to be faster than a local const, even though that the local version is more restricted. Is this because there has been more time spend on making globals fast?

thread: Julia-Users

Tested on:

Julia Version 0.4.0-dev+3227
Commit 242c357* (2015-02-09 11:34 UTC)
Platform Info:
  System: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

And

Julia Version 0.3.5
Commit a05f87b* (2015-01-08 22:33 UTC)
Platform Info:
  System: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3
@vtjnash vtjnash added the performance Must go faster label Feb 17, 2015
@vtjnash vtjnash changed the title Local scope for function storage Optimize closure and newvar storage Feb 17, 2015
@simonster
Copy link
Member

Related to #7953

@vtjnash
Copy link
Sponsor Member

vtjnash commented Mar 25, 2016

it looks like #13412 made this worse (by splicing a lot of unnecessary Box variables into the AST)?

@JeffBezanson
Copy link
Sponsor Member

I believe this particular code pattern is fixed.

@JeffBezanson
Copy link
Sponsor Member

See also #15276

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

No branches or pull requests

4 participants