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
Request for test: Tracing speed-up (<= 10x) #251
Comments
The code above is broken 😄 This version worked for me: require "benchmark/ips"
require "trailblazer/developer/trace/snapshot"
Snapshot = Trailblazer::Developer::Trace::Snapshot
inspect_only_flow_options = {
before_snapshooter: Snapshot::Deprecated.method(:default_input_data_collector),
after_snapshooter: Snapshot::Deprecated.method(:default_output_data_collector),
}
snapshot_flow_options = {
before_snapshooter: Snapshot.method(:before_snapshooter),
after_snapshooter: Snapshot.method(:after_snapshooter),
stack: Trailblazer::Developer::Trace::Stack.new
}
your_operation = Web::Diagram::Operation::Create # change to whatever you want to benchmark.
your_context = { params: { name: "test" } } # change to whatever your operation needs.
Benchmark.ips do |x|
x.report("inspect-only") do
stack, signal, (ctx, flow_options) = Trailblazer::Developer::Trace.invoke(
your_operation,
[
your_context,
inspect_only_flow_options
]
)
end
x.report("snapshot") do |x|
stack, signal, (ctx, flow_options) = Trailblazer::Developer::Trace.invoke(
your_operation,
[
your_context,
snapshot_flow_options
]
)
end
x.compare!
end |
Run this on an operation, this is quite an improvement if the numbers are to be believed 😅
|
@tiagotex Hahahaha, eh I think we should do some debugging on the debugging tomorrow morning?! 😆 |
More results from a huge client app.
and
|
Here is a new Gemfile, you don't have to do any benchmarking (unless you feel like it, that'd be cool, too!), but simply run your app's test suite. gem "trailblazer-operation", branch: "snapshot", ref: "2b645fbd607fa1ede9a6b101ef8d3ce71688a908", github: "trailblazer/trailblazer-operation"
gem "trailblazer-macro", branch: "snapshot", ref: "ef7436372b5cf88a39829e8a01e6d5e7ac3bf351", github: "trailblazer/trailblazer-macro"
gem "trailblazer-developer", branch: "snapshot", ref: "0367bdaf5c425ea00fcebddb2b5d28c1445c7aa5", github: "trailblazer/trailblazer-developer" |
@apotonick Tests are green and benchmark looks good as well, verified it on one big OP 🍻
|
A lot of work has been put into improving tracing in the
trailblazer-developer
gem and its#wtf?
method. In some projects we could benchmark a factor 10 improvement, with smallerctx
we measured 1.5.The speed improvement also brings internal changes so the
wtf?
method works with our upcoming visual debugger.Benchmarks requested!
You need to pull the latest
developer
gem.Please run the following code with simple and very complex operations in your application.
I owe you a beer per output you paste here! 💚
The text was updated successfully, but these errors were encountered: