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

Enable tprof #441

Merged
merged 6 commits into from
Jan 5, 2025
Merged

Enable tprof #441

merged 6 commits into from
Jan 5, 2025

Conversation

PragTob
Copy link
Member

@PragTob PragTob commented Nov 27, 2024

  • Fixes tprof :) #439
  • also fixes one of the samples not being an .exs 😁
    • also updates it and includes tprof
  • might consider only adding it on elixir 1.17+ but may be too much
  • still needs to be added to docs

@PragTob PragTob mentioned this pull request Nov 27, 2024
@PragTob
Copy link
Member Author

PragTob commented Nov 27, 2024

Of course I wrote a test that all built-in profilers work 😂

# anonymous fn/2 in :elixir_compiler_2.__FILE__/1 1 0.05 2 2.00
# :erlang.++/2 10000 14.46 533 0.05
# anonymous fn/1 in :elixir_compiler_2.__FILE__/1 10000 33.67 1241 0.12
# Enum.flat_map_list/2 10001 51.82 1910 0.19
Copy link

@ruslandoga ruslandoga Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there is a way to pass opts to the profilers, like call_memory to tprof to get heap allocs?

https://hexdocs.pm/mix/Mix.Tasks.Profile.Tprof.html#profile/2-options

Copy link

@ruslandoga ruslandoga Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchee already supports profile_after: {profiler, opts}

🤦

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely! See https://github.com/bencheeorg/benchee?tab=readme-ov-file#configuration for profile_after

a profiler - either as a tuple of {profiler, opts} (e.g., {:fprof, [sort: :own]}) or just the profiler (e.g., :fprof), which is equivalent to {profiler, []}. The accepted built-in profilers are :cprof, :eprof and :fprof.

Should make that clearer/include it in the profiler section of the README though!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah didn't see your response, sometimes github auto fetches sometimes it doesn't - but yeah :)

@PragTob
Copy link
Member Author

PragTob commented Nov 27, 2024

And of course I run 1.17 against erlang versions that don't have tprof yet and so I need to fix that behavior as well or fix the tests... 😅 Erlang versions are much worse though, sadly.

* Fixes #439
* also fixes one of the samples not being an .exs 😁
  * also updates it and includes tprof
* might consider only adding it on elixir 1.17+ but may be too much
* still needs to be added to docs
@PragTob PragTob merged commit fc45371 into main Jan 5, 2025
56 checks passed
@PragTob
Copy link
Member Author

PragTob commented Jan 5, 2025

@ruslandoga and merged! I deleted the branch, you should be able to just point it to main. Thanks!

@PragTob PragTob deleted the enable-tprof branch January 5, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tprof :)
2 participants