Skip to content
GitHub no longer supports this web browser. Learn more about the browsers we support.
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

Replace HexpmWeb.ViewHelpers import with an alias #887

Merged
merged 1 commit into from Jan 16, 2020
Merged

Conversation

@wojtekmach
Copy link
Member

wojtekmach commented Jan 15, 2020

To do this I used a small tool I was working on recently, import2alias.exs: mix run import2alias.exs Hexpm.ViewHelpers ViewHelpers. More info about that soon-ish, I'm planning to write up a blog post about it with some additional background information.

@ericmj

This comment has been minimized.

Copy link
Member

ericmj commented Jan 16, 2020

This is really great. Did you do any benchmarks or tests to see if this improved number of recompiled modules or recompilation time?

@wojtekmach

This comment has been minimized.

Copy link
Member Author

wojtekmach commented Jan 16, 2020

I sure did, here are the results,

before:

src/hexpm[master]% touch lib/hexpm/repository/package.ex && time mix compile
Compiling 114 files (.ex)

real	0m5.111s
user	0m14.431s
sys	0m2.771s

after:

src/hexpm[wm-aliases]% touch lib/hexpm/repository/package.ex && time mix compile
Compiling 78 files (.ex)

real	0m3.896s
user	0m9.933s
sys	0m1.760s

Clearly there's more work to be done, but that's a step in the right direction. We have a similar issue with import HexpmWeb.ControllerHelpers but that one is more subtle because we use some of the functions as function plugs, the solution would be to refactor them to module plugs but that's for the future.

@ericmj
ericmj approved these changes Jan 16, 2020
@wojtekmach wojtekmach merged commit 4c4f073 into master Jan 16, 2020
4 checks passed
4 checks passed
Build (138366431608) Summary
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
sourcelevel SourceLevel did not find any new or fixed issues.
Details
@wojtekmach wojtekmach deleted the wm-aliases branch Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.