profiling

How to convert recursive “divide and conquer” function to a dynamic programming function using decorators?

邮差的信 提交于 2020-01-16 18:53:13
问题 I am trying to write a decorator function which converts a pure recursive function with two arguments that uses a "divide and conquer" strategy to an equivalent but more efficient one using dynamic programming. Note: it is designated to decorate two input functions. So I am trying to memoize the values but I am not sure how to correctly implement it in the form of a decorator? Also how can it decorate two input functions? EDIT: This is what I have managed to do: profile_results = {} t = {} ''

How to convert recursive “divide and conquer” function to a dynamic programming function using decorators?

谁都会走 提交于 2020-01-16 18:53:05
问题 I am trying to write a decorator function which converts a pure recursive function with two arguments that uses a "divide and conquer" strategy to an equivalent but more efficient one using dynamic programming. Note: it is designated to decorate two input functions. So I am trying to memoize the values but I am not sure how to correctly implement it in the form of a decorator? Also how can it decorate two input functions? EDIT: This is what I have managed to do: profile_results = {} t = {} ''

Python profiling with spyder: times for constituents do not sum up to a total function's time

ⅰ亾dé卋堺 提交于 2020-01-16 08:01:12
问题 I am profiling my python code using Spyder IDE. As you can see in the screenshot below, it took 1.20 min = 80 sec for the _get_loglik_seq function to execute. However, the timing of various functions/procedures that constitutes this function are the following: solve_EV = 29.78s, c_get_gamma = 10.12 sec, norm = 6.57 sec, outer = 4.70 sec, <method dot ... : 2.17 sec, all others: <1 sec. If one sums up these times, the result will be about 54 s, which is way smaller than 80s. How is it possible?

Python profiling with spyder: times for constituents do not sum up to a total function's time

亡梦爱人 提交于 2020-01-16 08:00:02
问题 I am profiling my python code using Spyder IDE. As you can see in the screenshot below, it took 1.20 min = 80 sec for the _get_loglik_seq function to execute. However, the timing of various functions/procedures that constitutes this function are the following: solve_EV = 29.78s, c_get_gamma = 10.12 sec, norm = 6.57 sec, outer = 4.70 sec, <method dot ... : 2.17 sec, all others: <1 sec. If one sums up these times, the result will be about 54 s, which is way smaller than 80s. How is it possible?

Why gprof underestimates total time

[亡魂溺海] 提交于 2020-01-16 04:56:06
问题 I have CPU bound process which runs for 5 hours (CPU time by using getrusage() ) I tried to profile it by gprof. The total time main() took is only about 5000s. My program is CPU bound, it has some disc IO but it is not that significant. Profile interrupts are on, and my process in not multithreaded. 回答1: It only samples in routines it knows about. You calling new ? That's going to spend time in places where gprof doesn't go. BTW, if you're looking for ways to save some time (after 5 hours I

How to get profiling output of java programs running on Tomcat using java -prof option?

老子叫甜甜 提交于 2020-01-16 04:52:47
问题 in java programs, running the programs with java profiler will generate profiling output Ex- java -prof classfile_name How to get same profiling output of java programs running on Tomcat? I want to get an profiling output like this count callee caller time , like this in profiling output 1 java.util.LinkedHashMap.init()V java.util.HashMap.(IF)V 0 Can you tell me how to get an output like this for programs running on Tomcat? 回答1: Tomcat is also just a Java application, so you can add the same

Profiling performance of functions that call other functions

て烟熏妆下的殇ゞ 提交于 2020-01-15 02:47:26
问题 I'm writing a relatively complex function to do a start-to-finish data analysis. This function calls lots of sub-functions I have written (which themselves call sub-sub-functions, etc.). I'm looking for a tool to tell me how much time my function is spending on each sub-function & sub-sub-function, in order to see where I should look for performance improvements. Something analagous to MATLAB's profiler would be nice. For instance, a hypothetical function audit : #fun1 is called by fun2 fun1

Why can't I see my own application functions in golang's pprof

自闭症网瘾萝莉.ら 提交于 2020-01-15 01:24:32
问题 I'm trying to debug the performance characterics of my own program so I'm following the tutorial on the golang blog. But I have 1 small issues I can't investigate the my own functions or call in the resulting profiling output. I'm using this command to build my binary: go build -ldflags "-s -extldflags -static" -a -installsuffix cgo -o bin/brains And when I use go tool pprof to examine the result I can only (pprof) top10 -cum 2.38mins of 5.25mins total (45.32%) Dropped 125 nodes (cum <= 0

C# - Trying to find remaining EventHandler preventing control from going out of scope

。_饼干妹妹 提交于 2020-01-14 13:02:36
问题 Long story short, I inherited a fairly complex application and I'm trying to track down a memory leak involving a form. Right now, every time the form is closed and a new one brought up, the old one remains in memory. I tracked down an issue with a static event owned and set by a control within the program (apparently, so long as the static event was set, no instance of that control was considered out of scope, even when no one else referred to said controls). Now, I'm trying to track down

How to profile a rails controller that returns a json response with rack-mini-profiler?

本小妞迷上赌 提交于 2020-01-14 07:03:48
问题 I am using rack-mini-profiler in my rails 3.2 project. In gemfile: gem 'rack-mini-profiler' Everything works great. But my application is mostly a set of json endpoints. So while it is very useful to be to able to inspect the performance of html pages, I would like to also be able to see the performance of controllers that return json. Example of my controller: class UsersController < BaseController def json_method # you don't see the mini profiler ui for this controller render json: { users: